Splunk Search

Splunk query OR condition

balash1979
Path Finder

Trying to parse the following line:

newCount 20 OldCount 10

The following is my splunk query:

index="server" | rex "newCount"\s+"(?\w+)" | rex "OldCount"\s+"(?\w+)" | search newcount>0 | search oldcount>0 | timechart span=1h count

How can i ensure that irrespective of whether newCount or oldCount is greater than 0, my splunk query will catch that ?

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Use OR.

index="server" | rex "newCount"\s+"(?\w+)" | rex "OldCount"\s+"(?\w+)" | search newcount>0 OR oldcount>0 | timechart span=1h count

---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use OR.

index="server" | rex "newCount"\s+"(?\w+)" | rex "OldCount"\s+"(?\w+)" | search newcount>0 OR oldcount>0 | timechart span=1h count

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...