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!

Reduce and Transform Your Firewall Data with Splunk Data Management

Managing high-volume firewall data has always been a challenge. Noisy events and verbose traffic logs often ...

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...