84/5000
How can I put the time inside the file.log on the X axis?
I have the same doubt. could you solve it?
no, could you solve it?
Hi, have you solved this?
Hi,
Promtail will append a timestamp to the log line if it does not recognise it in the log line content. In order to force the use of the timestamp from your log line instead, you need to parse the timestamp expression in your Promtail configuration file.
An example:
Log line:
2023-02-23 08:41:01,789 [type] message
Promtail config file scrape configs stage:
scrape_configs:
- job_name: xxyyzz
pipeline_stages:
- regex:
expression: '^(?P<time>[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) \[(?P<Type>[A-Z ]*)\]\s+(?P<Message>.*)$'
- template:
source: time
template: '{{ Replace .Value "," "." 1 }}'
- timestamp:
source: time
format: '2006-01-02 15:04:05.999'
location: "Europe/Berlin"
You can read here about promtail configuration:
And about how to reformat your timestamp if it does not match a generic time format, like mine: