Bug Report
Describe the bug
Hi, I noticed certain float numbers such as 0.072 in a JSON data structure is being rewritten as 0.07199999999999999 when using the Format json option for the stdout and http output plugin.
I am sending out logs to a service that only accepts numbers with Decimal positions to be less than 16 digits. I am unable to find a way to preserve the number as-is when using the Format json option through the output plugins.
Any help with a fix/workaround is much appreciated!
To Reproduce
- Rubular link if applicable:
- Example log message if applicable:
- Steps to reproduce the problem:
tail.conf
[SERVICE]
Parsers_File parsers.conf
Flush 0.1
[INPUT]
Name tail
Path /test.log
Parser json
[OUTPUT]
Name stdout
Match *
Format json
json_date_key false
parsers.conf
[PARSER]
Name json
Format json
test.log
- Setup environment with files listed above.
- Run following command in terminal where tail.conf is located:
fluent-bit -c tail.conf
- Run the following command in a new terminal where test.log is located:
echo '{"test": 0.072}' >> test.log
Expected behavior
Expect output to be [{"test":0.072}] instead of [{"test":0.07199999999999999}].
Your Environment
- Version used: Fluent Bit v2.0.4
- Configuration:
- Environment name and version (e.g. Kubernetes? What version?):
- Server type and version:
- Operating System and version: MacOS Monterey v12.6
- Filters and plugins: tail Input plugin, JSON parser plugin, stdout Output plugin, and HTTP Output plugin
Additional context
Possibly, allow an option to preserve the number types without being reformatted when parsing.
Bug Report
Describe the bug
Hi, I noticed certain float numbers such as 0.072 in a JSON data structure is being rewritten as 0.07199999999999999 when using the
Format jsonoption for the stdout and http output plugin.I am sending out logs to a service that only accepts numbers with Decimal positions to be less than 16 digits. I am unable to find a way to preserve the number as-is when using the
Format jsonoption through the output plugins.Any help with a fix/workaround is much appreciated!
To Reproduce
tail.conf
parsers.conf
test.log
fluent-bit -c tail.confecho '{"test": 0.072}' >> test.logExpected behavior
Expect output to be
[{"test":0.072}]instead of[{"test":0.07199999999999999}].Your Environment
Additional context
Possibly, allow an option to preserve the number types without being reformatted when parsing.