Splunk Search

Search related question

skallaje
Engager

The following command should return the minimum value and it does.

source="SampleFilePERF.log" | stats min(ELAPSED_TIME_ms)

When I click on the returned minimum value, it should show me just the one event (or record) that is related to the minimum value. But, it doesn't. It shows all events from the log file. I have almost exhausted the entire Splunk documentation for Search, but can't find the command that would provide me the output I am looking for.

Is there a command that returns an entire event that is related to the output of an aggregate function (stats min | max) ? Responses are much appreciated.

Tags (1)
0 Karma
1 Solution

woodcock
Esteemed Legend

You need to change your search to this:

source="SampleFilePERF.log"
| stats min(ELAPSED_TIME_ms) AS min_ELAPSED_TIME_ms

And then create a custom drill down with a search that uses this:

source="SampleFilePERF.log" AND ELAPSED_TIME_ms=$click.min_ELAPSED_TIME_ms$.

Or, better yet, just use a search like this:

source="SampleFilePERF.log"
| eventstats min(ELAPSED_TIME_ms) AS min_ELAPSED_TIME_ms
| where ELAPSED_TIME_ms=min_ELAPSED_TIME_ms

View solution in original post

woodcock
Esteemed Legend

You need to change your search to this:

source="SampleFilePERF.log"
| stats min(ELAPSED_TIME_ms) AS min_ELAPSED_TIME_ms

And then create a custom drill down with a search that uses this:

source="SampleFilePERF.log" AND ELAPSED_TIME_ms=$click.min_ELAPSED_TIME_ms$.

Or, better yet, just use a search like this:

source="SampleFilePERF.log"
| eventstats min(ELAPSED_TIME_ms) AS min_ELAPSED_TIME_ms
| where ELAPSED_TIME_ms=min_ELAPSED_TIME_ms

skallaje
Engager

I wasn't even aware there was a "where" keyword in SPLUNK. I checked documentation for stats, eventstats, etc but couldn't find a solution to this problem. I also checked http://www.innovato.com/splunk/SQLSplunk.html, but it wasn't too helpful either. Anyway, Thank you very much, Gregg.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...