Splunk Enterprise

Creating new field from raw event

RSS_STT
Explorer

i want to create new index time field severity if raw json payload have level field value is Information.

{ "level": "Information", "ORIGIN_Severity_name": "CRITICAL", "ProductArea": "Application", "ORIGIN_Product": "Infrastructure"}

What's wrong in my transforms.conf configuration. Any help much appreciated.

transforms.conf

[severity]
REGEX = "level":\s\"(?<severity>\w+)
SOURCE_KEY = fields:level
FORMAT = severity::"INFO"
WRITE_META = true

 

Labels (1)
Tags (1)
0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @RSS_STT 

The issue here is the source_key which is incorrectly set, it should be set to _raw, although _raw is the default so you could just remove that line entirely.

You also do not need to specify the naming of the extraction in the REGEX and instead use $1, so your resulting transform will look like:

 

[severity]
REGEX = "level":\s\"(\w+)
FORMAT = severity::"$1"
WRITE_META = true

 

Please let me know how you get on and consider upvoting/karma this answer if it has helped.
Regards

Will

RSS_STT
Explorer

it helped but how can ensure that it's create severity = INFO field only when level=Information.

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Oh I see, sorry.

In that case you could do:

 

[severity]
REGEX = "level":\s\"(Informational)
FORMAT = severity::INFO
WRITE_META = true

 

This means it will only set the severity field (to INFO) when level=Informational - Is this what you want, or should it be other values if not Informational?

Is there a particular reason you are looking to make this index-time instead of a search-time change?

 

Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...