Skip to content
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

parser_json: Handle numeric timestamps #9187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hvenev
Copy link

@hvenev hvenev commented Aug 11, 2024

The time_unit_per_second parser option enables parsing JSON numbers as timestamps. The same time_key is used as for time_format.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
[PARSER]
	Name json
	Format json
	Time_Key timestamp
	Time_Unit_Per_Second 1
  • Debug log output from testing the change

Can't your CI do that?

  • Attached Valgrind output that shows no leaks or memory corruption was found

Can't your CI do that?

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

Can't your CI do that?

  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

TODO

Backporting

  • Backport to latest stable release.

Probably not?


Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@edsiper
Copy link
Member

edsiper commented Aug 22, 2024

I would suggest to extend time_format and use a special value like SECONDS instead of adding a new config property

@hvenev hvenev force-pushed the parse-numeric-time branch from cf3d7b4 to 19a4b9c Compare August 22, 2024 19:50
When the JSON parser is used, the `time_format` option may be set to a
unit in order to parse a numeric timestamp. The following units are
supported:

- `SECONDS`
- `MILLISECONDS`
- `MICROSECONDS`
- `NANOSECONDS`

Signed-off-by: Hristo Venev <[email protected]>
@hvenev hvenev force-pushed the parse-numeric-time branch from 19a4b9c to d1dfc64 Compare August 22, 2024 19:52
@hvenev
Copy link
Author

hvenev commented Aug 22, 2024

I would suggest to extend time_format and use a special value like SECONDS instead of adding a new config property

Like this?

@edsiper
Copy link
Member

edsiper commented Oct 27, 2024

@hvenev yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants