Splunk Search

How can I limit the number of events returned from a search?

nidhiagrawal
Explorer

I'm using Splunk to build some of the basic metrics. Events which are returned run in millions. I have to look for daily average response time, and have to run this search over a week of time. What is the option to limit my search to specific number of events say 100,000? Changing the time duration is not an option.

jmallorquin
Builder

Can you show us what kind of metrics do you want to make and a example of events?

0 Karma

sundareshr
Legend

How do you want to limit them, if not my time. Options are you could use keywords in your search to return only events that match. Or you could return top x like this .. | head x

0 Karma

sundareshr
Legend

If you're looking to find random events,see if this post gives you any ideas

https://answers.splunk.com/answers/141810/finding-random-events.html

0 Karma

nidhiagrawal
Explorer

Does head have an option to pick random events. if I choose 100,000 then it will be first of those. But ideally i would like to scatter the events during the given time range.

0 Karma

jmallorquin
Builder

Hi,

sundareshr is right but the problem of use | head x is that you truncate the search so you can't have accurate results

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...