Skip to content

0.1

This page documents the HTTP API available in Ochi 0.1.

  • Local default: http://127.0.0.1:9014
  • Multi-tenant routing uses X-Scope-OrgID header.
  • If the header is not provided, Ochi uses tenant default.

Readiness probe endpoint.

Used primarily by Grafana to confirm the datasource availability.

  • Body: none
  • Headers: none required
  • 200 OK
  • Content-Type: text/plain
  • Body: ready

Ingest logs using Loki JSON push format.

Read Loki ingestion API for more details.

  • Content-Type: application/json (required when header is set), only json encoding is supported for payloads
  • Content-Encoding: snappy, only snappy is currently supported for decompressing payloads.
{
"streams": [
{
"stream": {
"tag1": "alpha",
"tag2": "beta"
},
"values": [
[
"1715173665000000000", // timestamp in nanoseconds as a string
"same message", // log message
{
"field1": "x",
"field2": "x"
}
]
]
}
]
}

Per log line in values:

  • element 0: timestamp in nanoseconds as a string
  • element 1: log message as a string
  • element 2 (optional): structured metadata object (key -> string value) The JSON object must be a valid JSON object with string keys and string values. The JSON object should not contain any nested object.
  • 200 OK on successful ingestion
  • Empty body

Query logs by time range plus exact-match tags and fields.

  • Content-Type: application/json (required when header is set)
{
"start": 1715173664999999999,
"end": 1715173665000000001,
"tags": [
{ "key": "tag1", "value": "alpha" },
{ "key": "tag2", "value": "beta" }
],
"fields": [
{ "key": "field1", "value": "x" },
{ "key": "field2", "value": "x" }
]
}

Schema:

  • start: inclusive lower bound, Unix timestamp in nanoseconds
  • end: inclusive upper bound, Unix timestamp in nanoseconds
  • tags: array of exact-match tag filters
  • fields: array of exact-match field filters

200 OK with JSON array of matching lines:

[
{
"timestampNs": 1715173665000000000,
"fields": [
{ "key": "tag1", "value": "alpha" },
{ "key": "tag2", "value": "beta" },
{ "key": "field1", "value": "x" },
{ "key": "field2", "value": "x" },
{ "key": "", "value": "same message" }
]
}
]
  • The log message is returned as a field with empty key ("key": "").
  • Query filters are exact matches.