loki icon indicating copy to clipboard operation
loki copied to clipboard

Why does loki not support configuring the specified time zone?

Open hooklab opened this issue 2 years ago • 13 comments

Describe the bug Didn't find anywhere to configure loki timezone。

To Reproduce config the time zone

Expected behavior Show consistent time

Environment: loki latest version

Screenshots, Promtail config, or terminal output

111

222

hooklab avatar Jun 13 '22 07:06 hooklab

@oreak please describe how you are sending logs to Loki - are you pushing directly, using Promtail, something else?

dannykopping avatar Jun 13 '22 08:06 dannykopping

@oreak please describe how you are sending logs to Loki - are you pushing directly, using Promtail, something else?

I should have figured it out, is loki a fixed UTC time zone? In this way, if my local time zone is not UTC, then I need to change the time to UTC when Http api pushes, and then send.

hooklab avatar Jun 13 '22 11:06 hooklab

@oreak please describe how you are sending logs to Loki - are you pushing directly, using Promtail, something else?

It's bad, very bad, if loki is a fixed UTC timezone instead of a configurable timezone. It is still recommended that loki can customize the configuration time zone.

hooklab avatar Jun 13 '22 11:06 hooklab

@oreak please describe how you are sending logs to Loki - are you pushing directly, using Promtail, something else?

I send log by https://grafana.com/docs/loki/latest/api/#post-lokiapiv1push

hooklab avatar Jun 13 '22 11:06 hooklab

I have changed loki's code and recompiled, mainly modifying DefaultTimestampUTC to DefaultTimestamp , using the default time zone, which solved my problem.

hooklab avatar Jun 29 '22 07:06 hooklab

Hi! This issue has been automatically marked as stale because it has not had any activity in the past 30 days.

We use a stalebot among other tools to help manage the state of issues in this project. A stalebot can be very useful in closing issues in a number of cases; the most common is closing issues or PRs where the original reporter has not responded.

Stalebots are also emotionless and cruel and can close issues which are still very relevant.

If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry.

We regularly sort for closed issues which have a stale label sorted by thumbs up.

We may also:

  • Mark issues as revivable if we think it's a valid issue but isn't something we are likely to prioritize in the future (the issue will still remain closed).
  • Add a keepalive label to silence the stalebot if the issue is very common/popular/important.

We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, our sincere apologies if you find yourself at the mercy of the stalebot.

stale[bot] avatar Aug 13 '22 19:08 stale[bot]

This is also an issue for us.

kaujea avatar Sep 05 '23 12:09 kaujea

I assume this to be my issue as well. I am pushing log files through promtail but the log files do not have a timezone attached to them. If I controlled upstream I could simply modify the log files and append a timezone.

I need a timezone on Loki so it can assume timestamps without a timezone are in the default timezone.

I tried setting the timezone as outlined here with no corrections to the logged times.

cgsmith avatar Dec 20 '23 09:12 cgsmith

Can time zone configuration be supported

wyy-laodi avatar Jan 08 '24 04:01 wyy-laodi

Also an issue for me. Any hints on this?

slow-loris avatar Jan 24 '24 11:01 slow-loris

The problem has not been solved. It's really strange that you can't override this via the docker environment variables. This seems to indicate that it is hard-coded in the loki code that the time used must be UTC, perhaps there is a reason for this? If so, this reason should be mentioned in the documentation as it's quite disconcerting behaviour.

jmchantrein avatar Feb 15 '24 21:02 jmchantrein

It's weird that you can't change container's timezone with docker environment "TZ"

guluguru avatar Apr 30 '24 09:04 guluguru

I've ever seen Loki's code, it's a hard-coded fixed time zone.I've never seen a design like this, it's incredible. To change the time zone you can only change its code.

guluguru @.***> 于2024年4月30日周二 17:24写道:

It's weird that you can't change container's timezone with docker environment "TZ"

— Reply to this email directly, view it on GitHub https://github.com/grafana/loki/issues/6374#issuecomment-2084812492, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQGEICY5W2AQGHDTSDC273Y75PNLAVCNFSM5YTHESJ2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBYGQ4DCMRUHEZA . You are receiving this because you were mentioned.Message ID: @.***>

hooklab avatar Apr 30 '24 11:04 hooklab

Still an issue, an variable to define the timezone would greatly be appreciated :)

QuentiumYT avatar Jul 17 '24 07:07 QuentiumYT