I have following issue with loki promtail. Here is one configuration snippet from my promtail:
pipeline_stages:
- cri: {}
- regex:
expression: '^(?P<time>.*?)\|(?P<level>.*?)\|(?P<process>.*?)\|(?P<logger>.*?)\|(?P<thread>.*?)\|(?P<client>.*?)\|(?P<user>.*?)\|(?P<message>(?s:.*))$'
- labels:
level:
logger:
thread:
client:
user:
- labeldrop:
- filename
- template:
source: testo2
template: '{{ .level }} - {{ .user }}'
- output:
source: testo2
I'm using the regex function to receive the required information. After it I create the labels. For the final message I would like to overwrite the output.
My example of the output message: INFO - testo
The problem occurs in the template function. The variables are empty. Normally I thought I can use from the regex/label value to parse the variable inside the template.
What I'm doing wrong?
Thanks in advance.
to get the value from the label, the following format is required:
{{`{{ .level }}`}}