Splunk Search

Were to use where and when to use OR when to use AND

MeMilo09
Path Finder

Hi Guys, 

I am novice somewhat, and confusion has struck.

Where does the | where clause go in the query? Is it before stats typically or after, end of query? 

Also, AND -- I understand to use this when I want for example both burger and fries -- so like I want my results to show me both burger and fries so I would query - (burger AND fries)  ---- or is this OR instead of and? When would I use OR instead ? 

Would like just some brief examples. Thanks in advance 

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @MeMilo09,

about the where command, you can find all the information at https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where

In few words, it's usually used when you have to check the result (true or false) of an eval condition (e.g. | where value>100).

About the boolean operators, you can find more information at https://docs.splunk.com/Documentation/Splunk/8.2.0/SearchReference/UnderstandingSPLsyntax#Boolean_op...

in few words: OR must be always used, instead AND isn't mandatory in a search, but it's mandatory in the conditions (e.g. in eval command).

Put attention to the difference between NOT and != https://docs.splunk.com/Documentation/Splunk/8.2.0/Search/NOTexpressions

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @MeMilo09,

about the where command, you can find all the information at https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Where

In few words, it's usually used when you have to check the result (true or false) of an eval condition (e.g. | where value>100).

About the boolean operators, you can find more information at https://docs.splunk.com/Documentation/Splunk/8.2.0/SearchReference/UnderstandingSPLsyntax#Boolean_op...

in few words: OR must be always used, instead AND isn't mandatory in a search, but it's mandatory in the conditions (e.g. in eval command).

Put attention to the difference between NOT and != https://docs.splunk.com/Documentation/Splunk/8.2.0/Search/NOTexpressions

Ciao.

Giuseppe

gcusello
SplunkTrust
SplunkTrust

Hi @MeMilo09,

good for you,see next time!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

Get Updates on the Splunk Community!

Developer Spotlight with Brett Adams

In our third Spotlight feature, we're excited to shine a light on Brett—a Splunk consultant, innovative ...

Index This | What can you do to make 55,555 equal 500?

April 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...