All Apps and Add-ons

How to Field extraction / Calculated fields

VijaySrrie
Builder

Hi,

Need one field to be extracted or need a calculated field

I have two fields that are auto-extracted (action and Severity)
Values of action field = read, debug, modify
Values of Severity field = SUCCESS and FAILURE

Out of 100 logs 50 logs are having action field


All logs are having Severity field

Wherever action field is available in the logs, I want the same value, when there is no action field, I want the value of Severity to be disabled under action field


NOTE: For all the logs Index/Sourcetype and source are same

 

Labels (3)
Tags (1)
0 Karma

VijaySrrie
Builder

| eval action=if(isnull(action),severity,action)

It worked with this statement

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Yes, that is essentially what coalesce is doing 😀

ITWhisperer
SplunkTrust
SplunkTrust

Is this what you mean?

| makeresults count=10
| eval action=mvindex(split("read|debug|modify","|"), random()%6)
| eval Severity=mvindex(split("SUCCESS|FAILURE","|"),random()%2)
``` If action is not present, use value from Severity ```
| eval action=coalesce(action,Severity)
0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...