Loki Clients
Loki supports the following official clients for sending logs:
Picking a Client
While all clients can be used simultaneously to cover multiple use cases, whichclient is initially picked to send logs depends on your use case.
Promtail
Promtail is the client of choice when you’re running Kubernetes, as you canconfigure it to automatically scrape logs from pods running on the same nodethat Promtail runs on. Promtail and Prometheus running together in Kubernetesenables powerful debugging: if Prometheus and Promtail use the same labels,users can use tools like Grafana to switch between metrics and logs based on thelabel set.
Promtail is also the client of choice on bare-metal since it can be configuredto tail logs from all files given a host path. It is the easiest way to sendlogs to Loki from plain-text files (e.g., things that log to /var/log/*.log
).
Lastly, Promtail works well if you want to extract metrics from logs such ascounting the occurrences of a particular message.
Docker Logging Driver
When using Docker and not Kubernetes, the Docker logging driver for Loki shouldbe used as it automatically adds labels appropriate to the running container.
Fluentd and Fluent Bit
The Fluentd and Fluent Bit plugins are ideal when you already have Fluentd deployedand you already have configured Parser
and Filter
plugins.
Fluentd also works well for extracting metrics from logs when using itsPrometheus plugin.
Unofficial Clients
Please note that the Loki API is not stable yet and breaking changes may occurwhen using or writing a third-party client.
- promtail-client (Go)
- push-to-loki.py (Python 3)
- Serilog-Sinks-Loki (C#)