Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Send log data to Loki
There are a number of different clients available to send log data to Loki. While all clients can be used simultaneously to cover multiple use cases, which client is initially picked to send logs depends on your use case.
Grafana Clients
The following clients are developed and supported (for those customers who have purchased a support contract) by Grafana Labs for sending logs to Loki:
- Grafana Agent - The Grafana Agent is the recommended client for the Grafana stack. It can collect telemetry data for metrics, logs, traces, and continuous profiles and is fully compatible with the Prometheus, OpenTelemetry, and Grafana open source ecosystems.
- Promtail - Promtail is the client of choice when you’re running Kubernetes, as you can configure it to automatically scrape logs from pods running on the same node that Promtail runs on. Promtail and Prometheus running together in Kubernetes enables powerful debugging: if Prometheus and Promtail use the same labels, users can use tools like Grafana to switch between metrics and logs based on the label set.
Promtail is also the client of choice on bare-metal since it can be configured to tail logs from all files given a host path. It is the easiest way to send logs to Loki from plain-text files (for example, things that log to/var/log/*.log
). Lastly, Promtail works well if you want to extract metrics from logs such as counting the occurrences of a particular message. - xk6-loki extension - The k6-loki extension lets you perform load testing on Loki.
Third-party clients
The following clients have been developed by the Loki community or other third-parties and can be used to send log data to Loki.
Note
Grafana Labs cannot provide support for third-party clients. Once an issue has been determined to be with the client and not Loki, it is the responsibility of the customer to work with the associated vendor or project for bug fixes to these clients.
The following are popular third-party Loki clients:
- Docker Driver - When using Docker and not Kubernetes, the Docker logging driver for Loki should be used as it automatically adds labels appropriate to the running container.
- Fluent Bit - The Fluent Bit plugin is ideal when you already have Fluentd deployed
and you already have configured
Parser
andFilter
plugins. - Fluentd - The Fluentd plugin is ideal when you already have Fluentd deployed
and you already have configured
Parser
andFilter
plugins. Fluentd also works well for extracting metrics from logs when using itsPrometheus plugin. - Lambda Promtail - This is a workflow combining the Promtail push-api scrape config and the lambda-promtail AWS Lambda function which pipes logs from Cloudwatch to Loki. This is a good choice if you’re looking to try out Loki in a low-footprint way or if you wish to monitor AWS lambda logs in Loki
- Logstash - If you are already using logstash and/or beats, this will be the easiest way to start. By adding our output plugin you can quickly try Loki without doing big configuration changes.
These third-party clients also enable sending logs to Loki:
- Cribl Loki Destination
- ilogtail (Go)
- Log4j2 appender for Loki (Java)
- loki-logback-appender (Java)
- LokiLogger.jl (Julia)
- mjaron-tinyloki-java (Java)
- NLog-Targets-Loki (C#)
- promtail-client (Go)
- push-to-loki.py (Python 3)
- python-logging-loki (Python 3)
- Serilog-Sinks-Loki (C#)
- Vector Loki Sink
- winston-loki (JS)