Hello!
I am trying to parse some log data created by a command line tool for debugging purposes.
example logs are:
09:59:26 Project configuration field `modules` is deprecated in 0.13 and will be removed in 0.14. Please use the `scan` field instead.
10:00:47 ℹ jib → Configuring provider...
10:00:47 ✔ jib → Provider configured
10:00:47 ✔ jib → Provider ready
10:00:47 ℹ kubernetes → Configuring provider...
10:00:47 ✔ kubernetes → Provider configured
10:00:47 ℹ kubernetes → Fetching kubectl...
I got the parsing successfully into correct regex groups using (?P<time>\d{2}:\d{2}:\d{2})\s*(?P<output>.*)$
the problem that I am facing is when I try to use the time as a timestamp promtail throws an error. Its understandable as there is no date or timezone along with the initial log, is there a way i could go around it? or format the timestamp to only use the time period?
This is my pipeline:
pipeline_stages:
- regex:
expression: '(?P<time>\d{2}:\d{2}:\d{2})\s*(?P<output>.*)$'
- timestamp:
source: time
location: America/Los_Angeles
- output:
source: output
How would I go about solving this?
Also side note, if the timestamp needs the date produced. how can i extract the date from the file its being parsed through? eg garden_log_2023-12-31.log
Thank you so much for your time!