Alerting

Search inputlookup city & country exclusion before iplocation problem

joeybroesky
Path Finder

Attempting to exclude based on UserId/City/Country from inputlookup csv file but City/Country are not matching because iplocation is run after. How can I fix this?

index="o365data" eventtype="user_logins" NOT [| inputlookup exemptusers |fields UserId,City,Country | format]
| spath input=AuditData
| eval User = coalesce(UserId, UserIds)
| search Workload=AzureActiveDirectory User!=Unknown User!="*@emailaddress.org"
| rename ExtendedProperties{}.* as *
| eval ExtendedProperties=mvzip(Name,Value, "=")
| mvexpand ExtendedProperties
| eval Key=mvindex(split(ExtendedProperties,"="),0), Value=mvindex(split(ExtendedProperties,"="),1)
| rename ExtendedProperties{}.* as *
| eval ExtendedProperties=mvzip(Name,Value, "=")
| mvexpand ExtendedProperties
| eval Key=mvindex(split(ExtendedProperties,"="),0), Value=mvindex(split(ExtendedProperties,"="),1)
| iplocation ClientIP
| eval checkfail1=if(like(LogonError, "FaultDomainRedirect"), "true", "false")
| eval checkfail2=if(like(LogonError, "UserAccountNoFound"), "true", "false")
| where Country != "Canada" AND checkfail1 != "true" AND checkfail2 != "true"
| stats values(ClientIP) as "ClientIP", values(City) as "City", values(Country) as "Country", latest(_time) as "Latest Timestamp" by User
| convert ctime("Latest Timestamp")

Labels (2)
0 Karma
1 Solution

manjunathmeti
SplunkTrust
SplunkTrust

hi @joeybroesky,
You can remove the exclude sub search in the base search and search it after iplocation command:

| iplocation ClientIP
| search NOT [| inputlookup exemptusers | fields UserId,City,Country | format]

 

View solution in original post

manjunathmeti
SplunkTrust
SplunkTrust

hi @joeybroesky,
You can remove the exclude sub search in the base search and search it after iplocation command:

| iplocation ClientIP
| search NOT [| inputlookup exemptusers | fields UserId,City,Country | format]

 

joeybroesky
Path Finder

Thanks for your help manjunathmeti!

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