Skip to content

Instantly share code, notes, and snippets.

@xakrume
Created May 15, 2023 13:33
Show Gist options
  • Save xakrume/540ed34b4b24642d46c372b91d68d943 to your computer and use it in GitHub Desktop.
Save xakrume/540ed34b4b24642d46c372b91d68d943 to your computer and use it in GitHub Desktop.

Revisions

  1. xakrume created this gist May 15, 2023.
    18 changes: 18 additions & 0 deletions promtail.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    pipeline_stages:
    - logfmt:
    mapping:
    timestamp: time
    level:
    - match:
    ...
    - match:
    selector: '{job="exporters"}'
    stages:
    - regex:
    source: service
    expression: .+-(?P<environment>(stable|testing|unstable)$)
    - labels:
    environment:
    - template:
    source: environment
    template: '{% raw %}{{ if .Value }}{{ .Value }}{{ else }}default{{ end }}{% endraw %}'