Splunk Search

Limiting a Search by number of events over a period of time

RyanDonnelly22
Explorer

I am trying to search for a number of events over a select period of time (4 hours) and then expand that to see how much of this traffic is in a 30 day period. I can use the time ranger picker for the initial 4 hours, but when expand it, I am getting too much data. 

Search I am using:

index="Firewalls" action=blocked

| stats count by client_ip

| search count > 3500

| sort -count

Is there a way to limit the results to be something like "search count > 3500 over 4 hours" and have the time range be 30 days?

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

There are at least two different methods. One is to generate set of timeranges and run separate search limiting results to your desired limit for each timerange using map command. A bit ugly and spawns many subsearches.

Second one would be to search for all the values but add a "counter" for each hour using streamstats and return only those results which counter is less or equal to the limit. Uses just one search,  but still needs to search throughout the whole outer timerange.

I'm far from my computer ATM so I won't write SPL...

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