server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: ${LOKI_URL:-http://loki:3100/loki/api/v1/push}

scrape_configs:
  - job_name: baron-sso-container-logs
    docker_sd_configs:
      - host: unix:///var/run/docker.sock
        refresh_interval: 10s
    relabel_configs:
      # 1. 원본 메타데이터에서 Baron 및 Ory 관련 컨테이너만 필터링
      - source_labels: ['__meta_docker_container_name']
        regex: '/(baron_.*|oathkeeper|kratos|hydra|keto|ory_.*)'
        action: keep

      # 2. 필수 라벨 선부여 (강제성 확보를 위해 __address__ 참조)
      - source_labels: ['__address__']
        target_label: 'job'
        replacement: 'baron-sso-logs'
      - source_labels: ['__address__']
        target_label: 'app_env'
        replacement: '${APP_ENV:-development}'

      # 3. 컨테이너 이름 추출
      - source_labels: ['__meta_docker_container_name']
        regex: '/(.*)'
        target_label: 'container_name'

      # 4. 서비스 상세 라벨 부여 (baron_ 접두사 제거 등)
      - source_labels: ['container_name']
        regex: 'baron_(.*)'
        target_label: 'service'
      - source_labels: ['container_name']
        regex: 'baron_(.*)'
        target_label: 'job'
