log info
time:2023-11-06T09:59:12.233121Z
problem
I am a green hand. How do I use timestamp stage to process the time in the log and change it into the format “2006-01-02 15:04:05”
Here is my configuration:
- regex:
expression: '(?P<timestamp>\d{4}-\d{2}-\d{2}\w\d{2}:\d{2}:\d{2}.\w+).*'
- labels:
timestamp:
- timestamp:
format: "2006-01-02 15:04:05"
source: timestamp
location: "Asia/Shanghai"
error logs:
level=debug ts=2023-11-06T07:30:24.6458416Z caller=timestamp.go:196 component=file_pipeline msg="failed to parse time" err="parsing time \"2023-11-06T09:59:12.233121Z\" as \"2006-01-02 15:04:05\": cannot parse \"T09:59:12.233121Z\" as \" \"" format="2006-01-02 15:04:05" value=2023-11-06T09:59:12.233121Z