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!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...