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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...