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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...