loki(8)
Loki is a log aggregation system designed to store and query logs from Kubernetes clusters and other sources efficiently.
Synopsis
loki [OPTION]...Description
Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus. It indexes logs by labels rather than full-text search, making it cost-effective and easy to operate.
Loki is typically deployed as a service alongside Prometheus and Grafana for complete observability. It works with Promtail (a log shipping agent) to collect logs from files, containers, and systemd.
Configuration is handled via a YAML file, and Loki exposes metrics and a LogQL query interface for searching logs.
Common options
| Flag | What it does |
|---|---|
-config.file | Path to the Loki configuration file (default: loki-local-config.yaml) |
-target | Comma-separated list of components to run: all, distributor, ingester, querier, query-frontend, table-manager, ruler (default: all) |
-log.level | Log level: debug, info, warn, error (default: info) |
-print-config-stderr | Print the configuration to stderr on startup for debugging |
-version | Show the Loki version and exit |
-config.expand-env | Expand environment variables in config file using ${VAR} syntax |
Examples
Start Loki using a custom configuration file
loki -config.file=/etc/loki/loki-config.yamlStart Loki with debug logging enabled for troubleshooting
loki -config.file=/etc/loki/config.yaml -log.level=debugRun only the querier and query-frontend components (useful for scaling)
loki -target=querier -target=query-frontend -config.file=loki-config.yamlStart Loki and print the loaded configuration to stderr for verification
loki -config.file=/etc/loki/config.yaml -print-config-stderrRun Loki in a Docker container with a mounted configuration directory
docker run -v /etc/loki:/etc/loki grafana/loki:latest -config.file=/etc/loki/loki-config.yaml