Splunk Enterprise

Props and Transforms for JSON-like data?

Strangertinz
Path Finder

Hi Community, 

 

I am trying to come up with the proper props and transforms config to ingest the data from a source that writes data in json however the json is heavily nested and contains some field value pairs that I will also like to extract within the nested json data.  Sample data included below. Thanks in advance 

 

The field / value that I am trying to extract is in the key="key3" value within the brackets

 

 

{
"time": "2023-05-20T12:35:20.255445557-07:00",

"Key": "Value",

"Key2": "Value2",

"Key3": "[key3_field1=Value1] [key3_field2=Value2] [key3_field3=Value3] [key3_field4=Value4] [key3_field5=Value5]",

"Key4": ["key4_value1", "key4_value2", "key4_value3", "key4_value4"],

"key5" : {

"key5_key1": "key5_value1",

"key5_key2": ["key5_key2_value1", "key5_key2_value2", "key5_key2_value3"],

"key5_key3": {

"key5_key3_key1": "value531",

"key5_key3_key2": 532 ,

         }
   }

}

 

Tags (2)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

I'm expecting that your Key3 is on one line. You could try something like this on transform.conf

[extract-key3]
REGEX = \"Key3\":\s*\"([^\"]+)
FORMAT = Key3::$1
MV_ADD = 1

 and props.conf

[<your sourcetype here>]
TRANSFORMS = extract-key3

If you want to take only that value from data to index it and remove other you should add needed transforms to take only Key3 and put that on index queue and other to nullQueue.

You can found examples for that on Filter event data and send to queues

r. Ismo

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...