server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://loki:3100/loki/api/v1/push

scrape_configs:
  # 采集 Docker 容器日志
  - job_name: docker
    docker_sd_configs:
      - host: unix:///var/run/docker.sock
        refresh_interval: 5s
    relabel_configs:
      # 只采集带 edu- 前缀的容器日志
      - source_labels: ['__meta_docker_container_name']
        regex: '/(edu-.*).*'
        action: keep
      # 提取容器名作为 label
      - source_labels: ['__meta_docker_container_name']
        regex: '/(.*)'
        target_label: container_name
      # 提取镜像名
      - source_labels: ['__meta_docker_container_log_stream']
        target_label: stream
