Splunk Search

how to ignore fields runtime which arent available from being considered in the calculation?

sangs8788
Communicator

I am doing a calculation to add up all the time spent in each layer. But there are cases where few fields not existing/relevant. In that case how do i make it to consider only the fields present during runtime.

eval processing_time = Layera + layerb + layerc + layerd

Say a particular event doesnt have layerc - the processiing time isnt getting calculated. So how do i make it to ignore the fields which arent present ?

Tags (1)
0 Karma
1 Solution

vnravikumar
Champion

Hi @sangs8788

Try

your query...| fillnull value=0 Layera,layerb,layerc,layerd | eval processing_time = Layera + layerb + layerc + layerd

View solution in original post

0 Karma

vnravikumar
Champion

Hi @sangs8788

Try

your query...| fillnull value=0 Layera,layerb,layerc,layerd | eval processing_time = Layera + layerb + layerc + layerd
0 Karma

renjith_nair
Legend

@sangs8788 ,

Try

|eval processing_time=if(isnull(Layera),0,Layera)+if(isnull(layerb),0,layerb)+if(isnull(layerc),0,layerc)+if(isnull(layerd),0,layerd)

OR

|eval processing_time=0|foreach Layer* [eval processing_time=processing_time+<<FIELD>>]
---
What goes around comes around. If it helps, hit it with Karma 🙂
Get Updates on the Splunk Community!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...