Splunk Search

Can you help me with a problem with an AND operator in a CASE and IF statement?

kumagaur
New Member

I have one lookup in which there is a field which consist

Team Member
A1
A2
A3
A4
A5
A6
A7

Now,If
TeamMember=(A1 OR A2) AND A4 AND A7 then print Aseries
TeamMember=(A1 OR A2) and A5 AND A6 then print Bseries

I tried:

 |eval Team=if((con1=="A1 OR con1=A2)"AND con1=="A4" AND con1=A7,Aseries,Other)

I used case as well but no luck.

0 Karma

MuS
Legend

Hi kumagaur,

based on the provided examples this will work:

| makeresults 
| eval TeamMember="A1 A2 A3 A4 A5 A6 A7"
| makemv TeamMember 
| mvexpand TeamMember 
| eval Team = if((TeamMember="A1" OR TeamMember="A2") AND TeamMember="A4" AND TeamMember="A7", "foo" , "nope")

But, also based on your provided information this eval will never match anything because TeamMember has never at the same time either A1 or B2 and A4 and A7.

I would review either the use case or the events, because this based on the provided information will never work.

Hope this helps ...

cheers, MuS

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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