server:
  disable: true

positions:
  filename: /var/opt/promtail/promtail_digdag_position.yaml


clients:
  - url: http://<%= @LOKIENDPOINT %>/loki/api/v1/push

scrape_configs:
  - job_name: digdag
    static_configs:
    - targets:
        - localhost
      labels:
        job: digdag
        hostname: <%= @HOSTNAME %>
        __path__: /var/log/supervisor/digdag.log


    pipeline_stages:
    - match:
        selector: '{job="digdag"} |~ "^[0-9]+-[0-9]+-[0-9]+"'

        stages:
        - regex:
            expression: '^(?P<datetime>\d+\-\d+\-\d+ \d+:\d+:\d+)([\.\d]+)? (?P<timezone>[\+\d]+) \[(?P<level>[^\]]+)\] (?P<message>.+)$'

        - template:
            source: timestamp
            template: '{{ .datetime }} {{ .timezone }}'

        - timestamp:
            source: timestamp
            format: 2006-01-02 15:04:05 -0700

        - template:
            source: level
            template: '{{ if .level }}{{ .level }}{{ else }}notice{{ end }}'

        - template:
            source: level
            template: '{{ ToLower .level }}'

        - template:
            source: level
            template: '{{ regexReplaceAllLiteral "warn" .Value "warning" }}'

        - labels:
            level:

        - output:
            source: message

    - match:
        selector: '{job="digdag"} !~ "^[0-9]+-[0-9]+-[0-9]+"'

        stages:
        - template:
            source: level
            template: 'info'

        - labels:
            level: