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!

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...

Everything Community at .conf24!

You may have seen mention of the .conf Community Zone 'round these parts and found yourself wondering what ...

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...