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!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...