This is a stateless Loki façade. It translates KubeOpera queries into LogQL, fetches log streams from Loki's query_range API, and returns normalised results. No database — all state lives in Loki.
What It Does
- Accepts queries by service name, namespace, and time range
- Runs log pattern extraction using Loki's
| pattern filter
- Returns context logs (last N lines) for a given service + namespace pair
LogQL Translation
Each endpoint builds a LogQL selector:
| Endpoint | Generated selector |
|---|
/search?service=payments-api | {app="payments-api"} |
/search (no service) | {job="kubernetes"} |
/context?namespace=prod&service=api | {namespace="prod", app="api"} |
REST API
| Method | Path | Description |
|---|
GET | /api/v1/logs/search | Search log lines (?service=&start=&end=&limit=) |
GET | /api/v1/logs/patterns | Extract recurring log patterns (?service=&window=1h) |
GET | /api/v1/logs/context | Recent lines for a service/namespace pair (?service=&namespace=) |
GET | /healthz | Health check |
Environment Variables
| Variable | Default | Description |
|---|
LOKI_URL | http://localhost:3100 | Loki endpoint |
PORT | 8099 | HTTP port |