Splunk Search

Stop search after events matched

yuwtennis
Communicator

Hi!

I would like to ask question related to following thread.

http://answers.splunk.com/answers/8107/return-only-the-first-matching-event

Similar situation but bit different.

I have a search

index=A
| lookup Pack OUTPUT status
| where status="updated"
| stats first(fieldA) by Pack

If I execute above search , result is fine but
it keeps searching until end of indexA.

I want to stop the search after all the first() are returned.

Is this possible?

Thanks,
Yu

Tags (2)
0 Karma

Ayn
Legend

The problem is that until Splunk has checked all events, it can't know if it has found all the values of Pack, so it has to continue matching. If you know how many values of Pack exist, you can add a |head <N> after your stats command to make the search stop once it's found N values for Pack.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...