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!

Announcing Scheduled Export GA for Dashboard Studio

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

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...