1.5 KiB
1.5 KiB
Promtail - Log Shipper
Log collection agent that discovers Docker containers via the Docker socket and forwards stdout/stderr to Loki.
Access
| Endpoint | Details |
|---|---|
| HTTP Port | 9080 (health check, metrics) |
| Public access | None |
| Docker socket | unix:///var/run/docker.sock |
Configuration
Config file: ./promtail/promtail-config.yaml
Key Parameters
| Parameter | Value |
|---|---|
| HTTP Port | 9080 |
| Push target | http://loki:3100/loki/api/v1/push |
| Positions file | /tmp/positions.yaml (checkpointing) |
| Container refresh | Every 5s |
Scrape Job: docker
- Discovers containers via
docker_sd_configs - Label
container- container name (without leading/) - Label
stream-stdoutorstderr - Pipeline:
dockerparser for Docker log format
Data Collected
Collects logs from all running Docker containers on the host. Each log entry is enriched with:
| Label | Description |
|---|---|
container |
Container name |
stream |
Stream type (stdout/stderr) |
| Docker metadata | Image, compose project, etc. |
Dependencies
| Service | Role |
|---|---|
| Docker socket | Log source (service discovery + streaming) |
| Loki | Push destination |
| Grafana | Indirect - Grafana queries Loki |
Useful Commands
# Restart
docker compose restart promtail
# Follow logs
docker compose logs -f promtail
# Check status
curl http://localhost:9080/ready
curl http://localhost:9080/targets
# Upgrade
./upgrade-container-by-name.sh promtail