-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
More options for encoding.timestamp_format
#17323
Comments
👋 thanks for the request @vbmithr, I'm wondering if we should rethink that feature altogether. VRL has support for formatting timestamps, and it feels a bit off to have two separate ways to format timestamps. Maybe we could consider dropping the Either way, it does seem like a good idea to expand the options there. |
Hey @vbmithr ! Could you provide a bit more detail about your use-case including which sinks you are using? We are trying to understand if it makes sense to expand |
I use vector to simplify the logging/recording of public websocket data from cryptocurrency exchanges, I feed data to vector with the (unix) socket source and want the raw JSON data to be sent to AWS for archival. From there I will use a proprietary system to download this data and convert it to other formats or extracts parts I want from it, so I need to parse that data using fast JSON parsing code (like So I'd like to have my timestamp printed in UNIX microseconds. Sinks I use: |
Gotcha, thanks for adding your use-case @vbmithr . I have a vague sense that timestamp handling in Vector could benefit from an overhaul to improve the UX, but I think your suggestion here is reasonable and a small change so I'm happy to see it go in. If you or anyone else feels so motivated it would be something like adding the new formats here: vector/src/codecs/encoding/transformer.rs Lines 201 to 211 in 539f379
And handling them here: vector/src/codecs/encoding/transformer.rs Lines 149 to 177 in 539f379
|
I would like to add |
* `unix_ms`: milliseconds * `unix_us`: microseconds * `unix_ns`: nanoseconds * `unix_float`: seconds float vectordotdev#17323
* `unix_ms`: milliseconds * `unix_us`: microseconds * `unix_ns`: nanoseconds * `unix_float`: seconds float vectordotdev#17323
I have a similar use case. We want to write logs to CloudWatch, and incredibly, CloudWatch lacks the ability to parse RFC3339 (or any other standard format) strings into usable datetime objects! So, I was forced to use unixtime, but would really prefer sub-second resolution. I opened a PR to add some new formats. |
@mbneimann-at-work I didn't add these, but you could build on the pattern from the linked PR to add more formats. Here's a dummy PoC with some rfc3339 customizations. But at this point, I think (as suggested at the top), it might be better just to allow users to specify either the format string, or provide a vrl function to manipulate the timestamp however they want. Feel free to poach / modify my PoC, though. |
A note for the community
Use Cases
Currenty only
rfc3339
orunix
is supported, would be good to haveunix_ms
unix_us
unix_ns
Attempted Solutions
No response
Proposal
No response
References
No response
Version
vector 0.28.2 (x86_64-unknown-linux-gnu)
The text was updated successfully, but these errors were encountered: