Back to docsRecipe

Loki Logs Primer

Ship structured logs from Meridian into Grafana Loki for real-time tailing, label-based filtering, and long-term retention without the cost of a full Elastic stack.

Why Loki?

  • Index only metadata (labels), not full log bodies — cheap object storage.
  • Native LogQL query language with regex, JSON parsing, and aggregation.
  • Drops into existing Grafana dashboards alongside Prometheus metrics.

Quick Start

POST /loki/api/v1/push
Content-Type: application/json

{
  "streams": [{
    "stream": { "app": "meridian", "level": "info" },
    "values": [
      ["1782585523243000000", "User login OK"]
    ]
  }]
}

Meridian's agent writes JSON lines to a local buffer, batches every 2 seconds, and pushes to your Loki instance over HTTPS. Labels are kept low-cardinality — app, level, and host only.

Pro Tip

Use LogQL {app="meridian"} |= "error" in Grafana Explore to tail errors in real time. Combine with a histogram panel to spot spikes before customers notice.

Explore more recipes