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:
  - job_name: ppanel-file
    static_configs:
      - targets:
          - localhost
        labels:
          job: ppanel-server
          service_name: ppanel
          __path__: /var/log/ppanel-server/*.log
    pipeline_stages:
      - json:
          expressions:
            caller: caller
            content: content
            level: level
            timestamp: timestamp
      - timestamp:
          source: timestamp
          format: "2006-01-02 15:04:05.000"
          location: Asia/Shanghai
      - labels:
          caller:
          level:

  - job_name: nginx-file
    static_configs:
      - targets:
          - localhost
        labels:
          job: nginx
          service_name: nginx
          __path__: /var/log/nginx/*.log

  - job_name: docker-containers
    docker_sd_configs:
      - host: unix:///var/run/docker.sock
        refresh_interval: 15s
    relabel_configs:
      - source_labels: [__meta_docker_container_name]
        regex: '/(.*)'
        target_label: container
      - source_labels: [__meta_docker_container_label_com_docker_compose_service]
        target_label: compose_service
      - source_labels: [__meta_docker_container_log_stream]
        target_label: stream
      - source_labels: [__meta_docker_container_name]
        regex: '/(.*)'
        target_label: service_name
      - source_labels: [__meta_docker_container_id]
        target_label: __path__
        replacement: /var/lib/docker/containers/$1/$1-json.log
