Splunk Search

Add 2 columns in a table on applied condition

nivethainspire_
Explorer

I have 3 columns in a table as below.
I need to sum two colums(mag and depth) if place="7km W of Cobb,california" or "1km se of loma linda,california".
show the result in mag and make depth as 0 column as 0 on applied condition(place).alt text

my result should be as follows:
alt text
Please help me to make a query for my condition.

0 Karma
1 Solution

gokadroid
Motivator
your Base query to generate place , mag, depth
| eval mag=if(place="7km W of Cobb, California" OR place="1km SE of Loma Linda, California", mag+depth, mag)
| eval depth=if(place="7km W of Cobb, California" OR place="1km SE of Loma Linda, California", 0, depth)
| table place, mag, depth

View solution in original post

0 Karma

gokadroid
Motivator
your Base query to generate place , mag, depth
| eval mag=if(place="7km W of Cobb, California" OR place="1km SE of Loma Linda, California", mag+depth, mag)
| eval depth=if(place="7km W of Cobb, California" OR place="1km SE of Loma Linda, California", 0, depth)
| table place, mag, depth
0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...