Skip to content

Instantly share code, notes, and snippets.

@Terryhung
Created February 19, 2023 13:17
Show Gist options
  • Save Terryhung/f75728488476677ce16ebe3015e473be to your computer and use it in GitHub Desktop.
Save Terryhung/f75728488476677ce16ebe3015e473be to your computer and use it in GitHub Desktop.
server:
http_listen_address: 0.0.0.0
http_listen_port: 9080
positions:
filename: /tmp/positions.yaml
clients:
- url: url
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log
- job_name: containers
static_configs:
- targets:
- localhost
labels:
job: containerlogs
__path__: /var/lib/docker/containers/*/*log
docker_sd_configs:
- host: unix:///var/run/docker.sock
refresh_interval: 5s
pipeline_stages:
- json:
expressions:
output: log
stream: stream
attrs:
- json:
expressions:
tag:
source: attrs
- timestamp:
format: RFC3339Nano
source: time
- labels:
tag:
stream:
- output:
source: output
relabel_configs:
- source_labels:
- __meta_docker_container_name
regex: '/(.*)'
target_label: 'container_name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment