server:
  http_listen_port: 9080
positions:
  filename: /tmp/positions.yaml
clients:
  - url: http://loki:3100/loki/api/v1/push
scrape_configs:
  - job_name: falco
    static_configs:
      - targets: [localhost]
        labels:
          job: falco
          __path__: /var/log/falco.log

  - job_name: varlogs
    static_configs:
      - targets: [localhost]
        labels:
          job: varlogs
          __path__: /var/log/syslog

  # Coleta logs de todos os containers Docker via service discovery
  - job_name: docker_containers
    docker_sd_configs:
      - host: unix:///var/run/docker.sock
        refresh_interval: 5s
    relabel_configs:
      # Extrai o nome do container (remove a barra inicial)
      - source_labels: ['__meta_docker_container_name']
        regex: '/?(.+)'
        target_label: container
      # Stream (stdout/stderr)
      - source_labels: ['__meta_docker_container_log_stream']
        target_label: stream
      # Nome do serviço do docker-compose
      - source_labels: ['__meta_docker_container_label_com_docker_compose_service']
        target_label: service
      # Caminho do log dentro do container mountado
      - source_labels: ['__meta_docker_container_id']
        target_label: __path__
        replacement: /var/lib/docker/containers/$1/$1-json.log
