[feature] replace promtail with grafana agent

improve grafana provisioning
This commit is contained in:
2024-02-05 14:46:29 +07:00
parent 2ad87b2a43
commit 83a2756f3c
6 changed files with 93 additions and 64 deletions

49
agent/agent.yaml Normal file
View File

@@ -0,0 +1,49 @@
logs:
configs:
- name: local
clients:
- url: "http://${AGENT_LOKI_URL}/loki/api/v1/push"
scrape_configs:
- docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 10s
job_name: docker
pipeline_stages:
- drop:
drop_counter_reason: reject_old_samples
older_than: 30m
- static_labels:
job: docker
relabel_configs:
- regex: /(.*)
source_labels: [__meta_docker_container_name]
target_label: container_name
- source_labels: [__meta_docker_container_id]
target_label: container_id
- source_labels: [__meta_docker_container_log_stream]
target_label: stream
- source_labels: [__meta_docker_container_label_com_docker_compose_project]
target_label: compose_project
- source_labels: [__meta_docker_container_label_org_label_schema_vcs_ref]
target_label: vcs_ref
- source_labels: [__meta_docker_container_label_org_label_schema_version]
target_label: image_version
positions_directory: /opt/positions
traces:
configs:
- name: tempo
remote_write:
- endpoint: "http://${AGENT_TEMPO_URL}"
insecure: true
receivers:
otlp:
protocols:
http:
grpc:
automatic_logging:
backend: "logs_instance"
logs_instance_name: "local"
roots: true
server:
log_level: info