What's the Purpose of Time_Key in Fluent Bit Parsers?
To understand the Time_Key
option, it helps to know that when you don't specify this option, Fluent Bit uses the current system time as the timestamp for each log entry.
When you use the Time_Key
option in the parser configuration, you're specifying which field in your log data contains the actual timestamp. This is particularly useful when you want to preserve the original timestamp from the log source. Here's an example:
[PARSER]
Name json_parser
Format json
Time_Key timestamp
In this configuration, Fluent Bit will look for a field named "timestamp" in the JSON log data and use its value as the log entry's timestamp.
Additionally, you can use the Time_Keep
option in conjunction with Time_Key
:
[PARSER]
Name json_parser
Format json
Time_Key timestamp
Time_Keep On
The Time_Keep
option, when set to "On", instructs Fluent Bit to retain the original timestamp field in the processed log entry. This can be useful if you need to reference the original timestamp later in your log processing pipeline.
-
How to Check for Fluent Bit Internal Errors
To check for internal errors in Fluent Bit, you should set the Log_Level option in the [SERVICE] section to debug: Service Section Flush 1 Daemon off Log_Level debug ... When you r...
Questions -
How to Truncate Long Logs in Fluent Bit
To truncate logs in Fluent Bit, the easiest option is to use a Lua script. Assuming you have the following log entry from an application: {"status": "200", "ip": "127.0.0.1", "level": 30, "emailAdd...
Questions
Make your mark
Join the writer's program
Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.
Write for usBuild on top of Better Stack
Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.
community@betterstack.comor submit a pull request and help us build better products for everyone.
See the full list of amazing projects on github