Splunk Search

How do I remove a particular row from my stats command based on the value of another row?

avisriv
New Member
source="something_source" topic="something_topic1" OR topic="something_topic2" earliest = "-1d" client="cpu1305" | stats latest(msg) as Valuess by topic

Now, this search returns suppose like below:

**topic**                                                              **Valuess**
something_topic1                                                        3
something_topic2                                                        7

Here, if the value of something_topic1 is say 3, then i only want to display the row 'something_topic2', else I want to simply remove this row( 'something_topic2') from my stats result

Tags (3)
0 Karma
1 Solution

harishalipaka
Motivator

@avisri

Try below

| makeresults | eval topic="topic1",values=3 | append[| makeresults |eval topic="topic2",values=7 ] |eval topicx=if(topic="topic1" and values=3 ,"%","topic1") | eventstats first(topicx) as topicx |where topic like(topicx) |table topic values
Thanks
Harish

View solution in original post

0 Karma

harishalipaka
Motivator

@avisri

Try below

| makeresults | eval topic="topic1",values=3 | append[| makeresults |eval topic="topic2",values=7 ] |eval topicx=if(topic="topic1" and values=3 ,"%","topic1") | eventstats first(topicx) as topicx |where topic like(topicx) |table topic values
Thanks
Harish
0 Karma

harishalipaka
Motivator

Hi @avisri

Sorry, your accepted answer not reflected to my karma points. Can you please do it again

Thanks
Harish
0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...