Getting Data In

How to parse combined JSON and Syslog event?

mzeb
New Member

I have an event that has a syslog preamble with a JSON body.
They take this shape:

<190>0 2019-08-27T17:51:22.876570+00:00 ip-10-0-29-201 assurance-rails-staging 28462 - 6 info  {"method":"GET","path":"/agent/callbacks/refresh","format":"json","controller":"agent/lead_callbacks","action":"refresh","status":200,"duration":10.49,"view":0.56,"db":3.8,"params":{},"instance_id":"i-0fc05874277d98a0d","remote_ip":"27.34.111.207, 10.0.4.231"}

The syslog parses wonderfully but the JSON does not. Is there an easy way to make this happen? Thanks.

0 Karma
1 Solution

MuS
Legend

Hi mzeb,

based on the provided sample event you can setup props.conf and transforms.conf on your search head like this:

transforms.conf

  [myTransform]
  REGEX = "([^"]+)":((?:[\d\.\{\}]+)|\"(?:[^"]+))
  FORMAT = $1::$2

props.conf

[mySourceType]
REPORT-myUniqueClassName = myTransform

This will create new fields with names like method,path or format and so on, with value like GET,/agent/callbacks/refresh or json.

Hope this helps ...

cheers, MuS

View solution in original post

MuS
Legend

Hi mzeb,

based on the provided sample event you can setup props.conf and transforms.conf on your search head like this:

transforms.conf

  [myTransform]
  REGEX = "([^"]+)":((?:[\d\.\{\}]+)|\"(?:[^"]+))
  FORMAT = $1::$2

props.conf

[mySourceType]
REPORT-myUniqueClassName = myTransform

This will create new fields with names like method,path or format and so on, with value like GET,/agent/callbacks/refresh or json.

Hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...