Skip to content

key_value_parser should unescape strings #38119

Open
@gjasny

Description

@gjasny

Component(s)

pkg/stanza

Is your feature request related to a problem? Please describe.

I have a key-value coded log file where the value of some keys contains JSON data. Like this:

time="2025-02-19T17:49:48Z" level=info msg="{\"status\": \"OK\"}"

Right now, when being feed through the key_value_parser, the msg attribute contains the plain substring found between the " quotes:

{\"status\": \"OK\"}

One cannot easily feed that "escaped" string into the JSON parser.

Describe the solution you'd like

I'd like to have a key_value_parser configuration setting to un-escape quotes found in strings.

Describe alternatives you've considered

Right now I'm using the add operator with an EXPR to replace the \" with ". But I fear that this simple operation does not work in some corner cases.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions