Ingest logs using Promtail
Promtail is an agent that ships the contents of local logs to Grafana Enterprise Logs (GEL).
Verify that Promtail is running
For the following common installation methods, check that Promtail is running:
- binary: To check that the executable is running, use
ps -ef | grep promtail.
- Docker: To check if a Promtail container is running, run
- Kubernetes: To check that Promtail pods are running, use the
kubectl get pods | grep promtailcommand when you are in the correct namespace.
Configure Promtail to write to GEL
To configure Promtail to send logs to the demo tenant, add a clients block to its configuration.
Example of a minimal configuration:
server: http_listen_port: 9080 grpc_listen_port: 0 positions: filename: /tmp/positions.yaml clients: - url: http://enterprise-logs:3100/loki/api/v1/push basic_auth: username: demo password: <token> scrape_configs: - job_name: system static_configs: - targets: - localhost labels: job: varlogs __path__: /var/log/*log
For more information, refer to Configuring Promtail.
Run this Promtail configuration using Docker
To run this configuration, store the preceding configuration locally in the file
promtail.yaml, and run the following code:
$ docker run \ -d \ --name=demo-promtail \ --network=enterprise-logs \ -v $(pwd)/promtail.yaml:/etc/promtail/config.yml:z \ grafana/promtail:2.1.0
Verify that Promtail is writing to GEL
From Grafana Explore, you can query the data from your GEL cluster via the Enterprise Logs data source.