Hello! Splunk newbie here - I was hoping to get some advice on how to condense this search query I have. Is there another command I can use that will make it so I don't need to have so many eval statements? What I'm trying to do with the data I have is remove any results that contain the words Okta, FIDO, Google, and Voice so I'm left with the users that have the MFA factors Password and SMS authentication. Thanks in advance!
source="test.csv" sourcetype="csv"
| stats values("MFA Factor") as MFA, values("Last Enrolled_ISO8601") as "Last Enrolled", values( "Last Used_ISO8601") as "Last Used" by User, Login
| eval MFA= if(like(MFA,"Okta%"),null, MFA)
| eval MFA= if(like(MFA,"%FIDO%"),null, MFA)
| eval MFA= if(like(MFA,"Google%"),null, MFA)
| eval MFA= if(like(MFA,"Voice%"),null, MFA)
| where isnotnull(MFA)
source="test.csv" sourcetype="csv"
| stats values("MFA Factor") as MFA, values("Last Enrolled_ISO8601") as "Last Enrolled", values( "Last Used_ISO8601") as "Last Used" by User, Login
| regex MFA!="Okta|FIDO|Google|Voice"
source="test.csv" sourcetype="csv"
| stats values("MFA Factor") as MFA, values("Last Enrolled_ISO8601") as "Last Enrolled", values( "Last Used_ISO8601") as "Last Used" by User, Login
| regex MFA!="Okta|FIDO|Google|Voice"
Hi @nicolass,
you can use the OR option in the if confition of your eval command, something like this:
source="test.csv" sourcetype="csv"
| stats values("MFA Factor") as MFA, values("Last Enrolled_ISO8601") as "Last Enrolled", values( "Last Used_ISO8601") as "Last Used" by User, Login
| eval MFA=if(like(MFA,"Okta%") OR like(MFA,"%FIDO%") OR like(MFA,"Google%") OR like(MFA,"Voice%"),null, MFA)
| where isnotnull(MFA)
or use case instead if:
source="test.csv" sourcetype="csv"
| stats values("MFA Factor") as MFA, values("Last Enrolled_ISO8601") as "Last Enrolled", values( "Last Used_ISO8601") as "Last Used" by User, Login
| eval MFA= case(like(MFA,"Okta%"),null, like(MFA,"%FIDO%"),null, like(MFA,"Google%"),null, like(MFA,"Voice%"),null)
| where isnotnull(MFA)
Ciao.
Giuseppe