Reputation: 151
I have instance of Promtail, Loki and Grafana running. Following is my Promtail configuration
scrape_configs:
- job_name: docker_logs
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 10s
filters:
- name: label
values: ["logger=loki"]
relabel_configs:
- target_label: 'job'
replacement: 'docker'
- source_labels: ['__meta_docker_container_name']
regex: '/(.*)'
target_label: 'container'
positions:
filename: /tmp/positions.yaml
clients:
- url: http://loki:3100/loki/api/v1/push
server:
http_listen_port: 9080
grpc_listen_port: 0
It's running as expected, but I want to add a new label "Level" by parsing the logs of containers. Following is the sample of some logs lines. For example, if line contains INF or INFO, level=INFO OR if log contains ERR/ERR, level=ERROR
[11:26:05 INF] CalculatedValues Notification was successfully produced for unit:
[02/04/2025 05:29:05 INF] Kafka connection successfully.
trce: Grpc.AspNetCore.Server.ServerCallHandler[18]
dbug: Grpc.AspNetCore.Server.ServerCallHandler[15]
How can I configure Promtail? I am quite new to Promtail and any help or suggestion would be great.
Upvotes: 0
Views: 31