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

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!

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

🗣 You Spoke, We Listened Audit Trail v2 wasn’t written in isolation—it was shaped by your voices. In ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

 Prepare to elevate your security operations with the powerful upgrade to Splunk Enterprise Security 8.x! This ...

Get Early Access to AI Playbook Authoring: Apply for the Alpha Private Preview ...

Passionate about security automation? Apply now to our AI Playbook Authoring Alpha private preview ...