---
server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://gateway:3100/loki/api/v1/push
    tenant_id: tenant1

# scrape_configs:
#   - job_name: flog_scrape
#     docker_sd_configs:
#       - host: unix:///var/run/docker.sock
#         refresh_interval: 5s
#     relabel_configs:
#       - source_labels: ['__meta_docker_container_name']
#         regex: '/(.*)'
#         target_label: 'container'

scrape_configs:
  - job_name: loggen_apache_common
    docker_sd_configs:
      - host: unix:///var/run/docker.sock
        refresh_interval: 5s
        filters:
          - name: name
            values: ['loggen-apache-common']
    pipeline_stages:
      - regex:
          #expression: '^(?P<remote_host>\S+) (?P<user_identifier>\S+) (?P<user>\S+) \[(?P<ts>[^\]]+)\] \"(?P<request>[^\"]+)\" (?P<status>\d+) (?P<bytes_sent>\d+)$'
          #expression: '^(?P<_>\S+) (?P<_>\S+) (?P<_>\S+) \[(?P<_>[^\]]+)\] \"(?P<_>[^\"]+)\" (?P<status>\d+) (?P<_>\d+)$'
          expression: '^.* (?P<status>\d+) (?P<_>\d+)$'
      - labels:
          status:
    relabel_configs:
      - source_labels: ['__meta_docker_container_name']
        regex: '/(.*)'
        target_label: 'container'

  - job_name: container_scrape
    docker_sd_configs:
      - host: unix:///var/run/docker.sock
        refresh_interval: 5s
        filters:
          - name: name
            values: ['loggen-apache-combined']
    relabel_configs:
      - source_labels: ['__meta_docker_container_name']
        regex: '/(.*)'
        target_label: 'container'

  - job_name: generated-logs
    static_configs:
      - targets:
          - localhost
        labels:
          job: generated-logs
          __path__: /var/log/generated-logs.txt
    pipeline_stages:
      - json:
          expressions:
            http_method: 'method'
            http_status: "status"
      - labels:
          http_method:
          http_status:
