vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
18.21k stars 1.6k forks source link

vector vrl -z(timezone) not effective? #21766

Closed lddlww closed 1 week ago

lddlww commented 1 week ago

A note for the community

Problem

date: image

vector vrl: image

vector vrl -z Asia/Shanghai image

timezone it not effect at all;how can i do to solve it?

Configuration

No response

Version

vector 0.41.1 (x86_64-unknown-linux-gnu 745babd 2024-09-11 14:55:36.802851761)

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

jszwedko commented 1 week ago

Hi @lddlww !

Internally in Vector/VRL all timestamps are in UTC. The timezone is only used for parsing timestamps that lack a timezone. This is definitely a bit confusing. https://github.com/vectordotdev/vector/issues/3333 is a tracking issue for having timestamps actually encode a timezone (in which case now() would be in Asia/Shangai like you are expecting).

Let me know if that doesn't clear it up.

lddlww commented 1 week ago

thanks for reply so is vector also the same? i mean vector tz is always utc, even if the timezone is set? 企业微信截图_17313936934137

follow logs timezone is always utc,after set timezone=“Asia/Shanghai” image

jszwedko commented 1 week ago

so is vector also the same? i mean vector tz is always utc, even if the timezone is set?

That's correct, timestamps in VRL and Vector are always internally represented in UTC.

lddlww commented 1 week ago

oops, thanks again