Splunk Search

Search data by result count

balcv
Contributor

I have a search that returns a list of users and the country logins have occurred from grouped by user.

index=o365 UserloginFailed* 
| iplocation ClientIP
| search Country!=Australia
| stats values(Country) by user

So if a user logins from one Country, then a get a single record for the user (user, Country). 
If a user logins in from multiple locations, I get the user name in one column and a list of the source locations in the values(County) column.

I would like to construct the search so that only see those users who have logins from multiple Countries.
Thanks

Labels (1)
0 Karma
1 Solution

dtburrows3
Builder

I think this SPL will do what you are looking for.

index=o365 UserloginFailed* 
| iplocation ClientIP
| search Country!=Australia
| stats values(Country) as Country by user
| where mvcount(Country)>1

View solution in original post

balcv
Contributor

Perfect.  Thank you @dtburrows3 

0 Karma

dtburrows3
Builder

I think this SPL will do what you are looking for.

index=o365 UserloginFailed* 
| iplocation ClientIP
| search Country!=Australia
| stats values(Country) as Country by user
| where mvcount(Country)>1
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...