-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
promtail: timestamp in --dry-run mode is missing timezone information #3679
Comments
It's possible that promtail always output in the host time. This is where the code is https://github.com/grafana/loki/blob/main/clients/pkg/promtail/client/logger.go#L77 It's also possible that the timestamp is not parsed correctly have you tried debug logs ? |
You are right, it is just the logger. I would propose to change the logger to either use local time or include timezone in output
See https://play.golang.org/p/1S8iNtX2RZ3 I can create PR, if it's clear what's needed. |
Describe the bug
Given a nginx log with date & time with missing timezone information. I would like to interpret the time as local timezone.
I tried timestamp stage with location field but it looks like that this field does nothing.
Maybe I do something terrible wrong but how can I read a nginx log without timezone information and interpret it as local timezone?
To Reproduce
Expected behavior
The timestamp should be affected by location field in some way, or not?
Even for timestamps with timezone information does not affect timestamp at all.
Maybe it's just a dry-run bug not showing the timezone?
Environment:
Screenshots, Promtail config, or terminal output
file without timezone: notz.log
promtail.yaml
location: "America/New_York"
location: "Europe/Berlin"
location: "Local"
location: "Foo"
removed timestamp stage
2021-05-04T07:19:05 {filename="/home/kbudde/example/notz.log", level="error", time_local="2021/04/30:00:57:19"} 2021/04/30:00:57:19 [error]
file with timezone tz.log
promtail.yaml
location: "America/New_York"
location: "Europe/Berlin"
location: "Local"
location: "Foo"
removed timestamp stage
The text was updated successfully, but these errors were encountered: