Security

How to use the OR operator?

SplunkBaby
Explorer

Hi I want to get the OR result of field Emp Code in search.
I tried below conditions,but none of them worked.

host=datahost where "Emp Code"=FCH OR "Emp Code"=ABC
host=datahost "Emp Code"=FCH OR "Emp Code"=ABC
host=datahost "Emp Code"=(FCH ABC)

Can you help pls.

Labels (1)

the_wolverine
Champion

Try:

host=datahost Emp_Code=FCH OR Emp_Code=ABC

SplunkBaby
Explorer

Thanks this solves my issue

0 Karma

the_wolverine
Champion

Typically, Splunk will replace the space in your field name with _, so "Emp Code" would be Emp_Code.

yannK
Splunk Employee
Splunk Employee

The second one is close to reality.

host=myhost myfield=A OR myfield=B myotherfield=C

is equivalent to

host=myhost AND ( myfield=A OR myfield=B ) AND myotherfield=C

If you are confused, add parenthesis.

SplunkBaby
Explorer

Thanks this solves my issue

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

In principle your second approach is correct... however, I'm a bit doubtful about the field name. Do your field extractions really yield a field named Emp Code?

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