Promtail config for PostgreSQL logs

Hello,
I am trying to configure promtail for a PostgreSQL where timestamps are in CET timezone. I also wish to take into account multiline feature to reassemble such lines.

This is the config:

 scrape_configs:
- job_name: postgres
  pipeline_stages:
    - multiline:
        firstline: '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} CET'
    - regex:
        expression: '^(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3} CET) (?P<content>.*)$'
    - timestamp:
        source: time
        format: 2006-01-02 03:04:05.000 CET
    - output:
        source: content

This a sample log file:

https://pastebin.com/nwacnfy4

And this is the debug output from promtail, parsing the above log:

https://pastebin.com/40T7wmVu

Nothing is inserted in the loki database.
Thanks for your help.

I don’t see anywhere you set the value for content so it’s likely empty. I think you can just remove this stage completely.

Thanks Elwech. It is defined in the regex expression.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.