0

When using Promtail for log scraping, is there a way to configure two labels with the same value based on a single regular expression? So given something like this:

    - match:
        selector: '{app="my-app"}'
        stages:
        - regex:
          expression: '.*"(some-string)\":\s?"(?P<some_label>[0-9a-zA-Z-_;\.]*)".*'
          source: log
    - labels:
        some_label:

I would want to add a second label some_other_label with the same value. Is there a way to do this without having to re-parse the log just to give the capture group a different name?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Thomas Lötzer
  • 24,832
  • 16
  • 69
  • 55

1 Answers1

1

I actually found it myself:

    - match:
        selector: '{app="my-app"}'
        stages:
        - regex:
          expression: '.*"(some-string)\":\s?"(?P<some_label>[0-9a-zA-Z-_;\.]*)".*'
          source: log
    - labels:
        some_label:
        some_other_label: some_label
Thomas Lötzer
  • 24,832
  • 16
  • 69
  • 55