Splunk Search

How to search users who are logged in from 2 or more IP addresses within a span of 10 minutes?

joec90
New Member

I am looking to parse apache logs to locate all users who are logged in from two or more IP addresses within a 10 minute time span.

The search I am performing appears not to be taking the timeframe into consideration or is including records with the same user and same IP within a 10 minute timeframe.

user=* clientip=* | iplocation clientip | bucket _time span=10m | stats dc(clientip) as dc_clientip values(clientip) as clientip values(City) as City values(Region) as Region values(Country) as Country by user | where dc_clientip > 1

Any assistance would be greatly appreciated.

Thanks.

Tags (4)
0 Karma

MuS
Legend

Hi joec90,

you almost got it, stats needs to know that you used timed buckets so you need to add _time to the stats command like this:

 user=* clientip=* | iplocation clientip | bucket _time span=10m | stats dc(clientip) as dc_clientip values(clientip) as clientip values(City) as City values(Region) as Region values(Country) as Country by user, _time | where dc_clientip > 1

hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...