Splunk Search

How do I edit my search to only display results based on these conditions?

manhuang
Explorer
index=app sourcetype=epcpromotionsevent | stats count as num  by eventName,hotelId

The search above will display count, eventName, and hotelId.
I only want to display results based on these conditions:
1.when count is 1, and more than 2 row data record, then display.
2.when count is more than 1, display.
3.others, no display.

0 Karma
1 Solution

sundareshr
Legend

See if this works for you

index=app sourcetype=epcpromotionsevent | stats count as num  by eventName, hotelId | stats values(eventName) as eventName values(hotelId) as hotelId count by num | where count > 1 OR num>1

View solution in original post

0 Karma

sundareshr
Legend

See if this works for you

index=app sourcetype=epcpromotionsevent | stats count as num  by eventName, hotelId | stats values(eventName) as eventName values(hotelId) as hotelId count by num | where count > 1 OR num>1
0 Karma

jmallorquin
Builder

index=app sourcetype=epcpromotionsevent | stats count as num by eventName,hotelId | where count > 1

0 Karma

manhuang
Explorer

1.when count is 1, and more than 2 row data record, then display.

not just count bigger than 1 are displayed,it needs two data records whose count is bigger than 1.
If only one row data record which count is 1, I dont want to display.

0 Karma

jmallorquin
Builder

index=app sourcetype=epcpromotionsevent | stats count as num dc(eventName) as dc_e dc(hotelId) as dc_h by eventName,hotelId |eval row=dc_e+dc_h| where count > 1 AND row>2

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

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

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