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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...