Hi, I'm trying to figure out how to extract fields...
# support
Hi, I'm trying to figure out how to extract fields from log messages. The messages are emitted as json lines and picked up, and when I look in the signoz ui at the json for an entry, the
field is a string. I assume that means I have to use a
to get the structured data out of it, but no matter what I do it doesn't seem to actually parse it, so does anybody know what might be wrong? There are no errors in the collector log...
I tried adding this to the operators:
Copy code
- type: json_parser
          if: 'body startsWith "{"'
          parse_from: body
          parse_to: attributes.body
But no
field appears anywhere
@nitya-signoz can help here
Yeah you will have to use json parser, based on your log line you migh have to use a regex parse if there are non json elements in your log line ex:- https://github.com/SigNoz/logs-benchmark/blob/0b2451e6108d8fa5fdd5808c4e174bd52b9d55d3/signoz/signoz-client/otel-collector-config.yaml#L9