Splunk Search

Group same IPs used in time period by user

mobrienmoore1
New Member

Hello,

I am trying to create a search where the same IP is used more than 50 times by the same email address. So far this is all that I have:

index=* sourcetype=* | stats count by ip | where count > 50

I've tried using various stats commands to add in the usernames, but nothing seems to be working. Any help would be appreciated.

0 Karma

elliotproebstel
Champion

Your current search will tell you if the same IP is seen in more than 50 events, regardless of email_address. Assuming the events contain both the email_address and IP, then this should work:

index=* sourcetype=* 
| stats count by email_address, ip 
| where count > 50

If the email_address and IP are not seen in the same event, we'd probably need to see some sample events to help structure a query.

0 Karma

mobrienmoore1
New Member

Email addresses and IPs are in the same event. I first want to find all IPs used more than 50 times, then pull the email addresses out of those events where the IP has been found to have been used more than 50 times.

0 Karma

elliotproebstel
Champion

When you say "all IPs used more than 50 times", do you mean IPs that have generated at least 50 events in your logs? If so:

index=* sourcetype=*
| stats values(email_address) AS email_address, count by ip
| where count>50

This will return all IP addresses seen in more than 50 events and the email_address values associated with those IP addresses.

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...