Splunk Search

How to properly use AND / OR in search?

eddychuah
Path Finder

I'm new to this community, any help will be greatly appreciated!!!

How can i search groups of keywords but i would like the search result to include all of them

Example, give me ALL results where you see SYSERR0001 apple or SYSERR0001 orange or SYSERR0001 grape

i find that if i use the or statement above, splunk search ONLY returns me the right most OR that it finds, however I wish to locate all events that contains the keyword pairs of SYSERR0001 apple or SYSERR0001 orange or SYSERR0001 grape

Tags (3)
0 Karma
1 Solution

eddychuah
Path Finder

nevermind, figured it out

(apple OR orange OR grape) AND SYSERR0001

View solution in original post

0 Karma

eddychuah
Path Finder

nevermind, figured it out

(apple OR orange OR grape) AND SYSERR0001

0 Karma

sideview
SplunkTrust
SplunkTrust

Yep. and by the way "AND" is kinda funny in Splunk. It's always redundant in search, so although Splunk doesn't give you an error, you can always remove it when you see it in the initial search clause, or in a subsequent search command downstream. Another way of looking at this is that Splunk mentally puts an "AND" in between any two terms where there isn't an OR. Thus the explicit ones are unnecessary.

Bottom line - (apple OR orange OR grape) SYSERR0001 will work just as well.

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 ...