Slide 3 of 4

HTTP API (logs)

HTTP API for logs

What it’s for: Custom integrations, scripts, serverless functions, or any tool that can make HTTP requests.

HTTP API is a simple REST endpoint for sending logs to Loki (any HTTP client can use it).

HTTP API logs flow

Trade-offs

Best for: Custom integrations, scripts, serverless functions, or tools with HTTP output

ProsCons
Works with any HTTP clientYou handle batching and retries
No special SDK or protocolLess structured than OTLP
Simple JSON formatManual formatting required
Great for custom integrations

Documentation

View the full documentation. Learning path coming soon!

HTTP API for logs

Script

The HTTP API is the simplest way to send logs to Grafana Cloud. It’s a REST endpoint that accepts log entries via HTTP POST. Any tool, script, or application that can make HTTP requests can send logs this way.

Loki’s HTTP API accepts logs in JSON format with labels and log lines. You authenticate with your Grafana Cloud credentials, POST your logs to the endpoint, and they’re stored in Loki immediately.

This approach is incredibly flexible. You can use it from shell scripts with curl, from custom applications, from serverless functions, or from any log shipper that supports HTTP outputs. There’s no special protocol or SDK required, just HTTP.

The trade-off is that you’re responsible for formatting, batching, and retry logic. Tools like Promtail, Fluentd, or Fluent Bit handle these details for you, but if you’re writing custom integrations, the HTTP API gives you direct access.