Slide 3 of 4

HTTP API (logs)

HTTP API for logs

What it’s for: Proof-of-concept tests, development work, or last resort when other options aren’t available.

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

HTTP API logs flow

Note: Not recommended for production environments. Use a robust collector like Grafana Alloy, Promtail, or Fluent Bit for production logging instead.

Trade-offs

Best for: Quick POC tests, development, or when other pathways are unavailable

ProsCons
Works with any HTTP clientNot recommended for production
No special SDK or protocolYou handle batching and retries
Simple JSON formatNo built-in buffering or error handling
Great for testing and POCsManual formatting required

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.

However, the HTTP API is not recommended for production environments. It’s best for quick proof-of-concept tests, development work, or as a last resort when other pathways aren’t available. For production, use a robust collector like Grafana Alloy, Promtail, or Fluent Bit. These tools handle batching, retries, buffering, and error handling that are critical for reliable production logging.