$linuxjunkies
>

promtail(1)

Promtail is a log collector agent that ships logs to Loki for storage and querying.

UbuntuDebianFedoraArch

Synopsis

promtail [flags]

Description

Promtail is a agent which reads logs from files, systemd journal, syslog, and other sources, then pushes them to Loki. It discovers targets and tails logs, extracting labels from log paths and content for structured indexing. Promtail runs as a daemon and is typically deployed on each machine that generates logs.

Configuration is managed via a YAML file that specifies scrape configs (which logs to collect), relabel rules for label extraction, and target discovery mechanisms. Promtail then authenticates to a Loki instance and streams the logs with their associated labels.

Common options

FlagWhat it does
-config.filePath to the Promtail configuration file (default: promtail-local-config.yaml)
-config.expand-envExpand environment variables in config file
-log.levelLog level (debug, info, warn, error; default: info)
-log.formatLog output format (logfmt or json; default: logfmt)
-server.http.listen-addressHTTP server listen address (default: 0.0.0.0:3100)
-server.grpc.listen-addressgRPC server listen address (default: 0.0.0.0:9096)
-print-config-stderrPrint configuration to stderr at startup
-versionShow version and exit

Examples

Start Promtail with the specified configuration file to begin collecting logs

promtail -config.file=/etc/promtail/config.yaml

Start Promtail in debug mode for verbose logging to troubleshoot issues

promtail -config.file=/etc/promtail/config.yaml -log.level=debug

Run Promtail listening only on localhost for development or testing

promtail -config.file=config.yaml -server.http.listen-address=localhost:3100

Start Promtail and expand environment variables in the configuration file

promtail -config.file=/etc/promtail/config.yaml -config.expand-env

Display the parsed configuration to stderr to verify correct loading

promtail -print-config-stderr -config.file=config.yaml

Related commands