server:
  http_listen_port: 9080
  grpc_listen_port: 0  # gRPC disabled — used for Promtail clustering only; single-node deployment

positions:
  filename: /tmp/positions.yaml  # /tmp is a named volume (promtail_positions) — persists across restarts

clients:
  - url: http://loki:3100/loki/api/v1/push
    # Loki HTTP API is unauthenticated internally. Any container on obs-net can push logs.
    # Acceptable: only trusted application containers join this network.

scrape_configs:
  - job_name: docker-containers
    docker_sd_configs:
      - host: unix:///var/run/docker.sock
        refresh_interval: 5s
    relabel_configs:
      - source_labels: ['__meta_docker_container_name']
        regex: '/(.*)'
        target_label: 'container_name'
        # Note: container_name differs between dev (archive-backend) and prod
        # (archiv-production-backend-1). Prefer compose_service for stable LogQL
        # queries across environments — it is stable: backend, db, minio, etc.
      - source_labels: ['__meta_docker_container_label_com_docker_compose_service']
        target_label: 'compose_service'
      - source_labels: ['__meta_docker_container_label_com_docker_compose_project']
        target_label: 'compose_project'
      - source_labels: ['__meta_docker_container_log_stream']
        target_label: 'logstream'
      - source_labels: ['__meta_docker_container_label_com_docker_compose_service']
        target_label: 'job'
