Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

double escaping problem with nested json string #10824

Closed
huanggze opened this issue Jan 22, 2019 · 0 comments
Closed

double escaping problem with nested json string #10824

huanggze opened this issue Jan 22, 2019 · 0 comments

Comments

@huanggze
Copy link

huanggze commented Jan 22, 2019

Hi, fluentbit people. I am facing a double escaping problem which is sort of related to #615

The only difference with #615 is in that the failed log contains nested json string, for example. my log is as follow

{"id":"3","log":{"level_1":"{\"apiVersion\":\"batch/v1beta1\",\"kind\":\"CronJob\"}"}}

I would expect the output as:

{"id":"3","log":{"level_1":"{\"apiVersion\":\"batch/v1beta1\",\"kind\":\"CronJob\"}"}}

but the output is actually:

{"id":"3", "log":{"level_1":"{\\\"apiVersion\\\":\\\"batch/v1beta1\\\",\\\"kind\\\":\\\"CronJob\\\"}"}}

my fluent-bit-config.yaml is as follows"

[SERVICE]
    Flush         1
    Log_Level     info
    Daemon        off
    Parsers_File  parsers.conf

[INPUT]
    Name              tail
    Tag               audit.*
    Path              /var/log/containers/sample.log
    Parser            docker
    DB                /var/log/flb_kube.db
    Mem_Buf_Limit     5MB
    Skip_Long_Lines   Off
    Refresh_Interval  10

[OUTPUT]
    Name file
    Match audit.*
    Path /var/log/output.txt

[PARSER]
    Name        docker
    Format      json
    # Command      |  Decoder | Field | Optional Action
    # =============|==================|=================
    Decode_Field_As   escaped    log
    Decode_Field_As   escaped    level_1

Note that I have no problem with {"id":"2", "log":"hello \"AAA\" world"} formmated log. And I can get a correct output as {"id":"2", "log":"hello \"AAA\" world"}

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

No branches or pull requests

1 participant