Splunk Search

Average time on only top results

jevenson
Path Finder

I'm trying to get the top 10 uri's from our IIS logs, and get the average time taken on each of those. I can't quite figure out how to do it. If I use the top command, when I pipe it to a chart I no longer have the time_taken field.

This search works, but it returns all uri's, and I just want the top 10. There's got to be a way to do this.

sourcetype=iis | fields time_taken, cs_uri_stem | chart avg(time_taken) by cs_uri_stem

Tags (1)
0 Karma
1 Solution

sowings
Splunk Employee
Splunk Employee

Start with a subsearch to find the top 10 URIs, then run a search to find average time:

[ search sourcetype=iis | fields cs_uri_stem | top limit=10 showperc=f showcount=f cs_uri_stem ]
sourcetype = iis | fields cs_uri_stem time_taken | chart avg(time_taken) by cs_uri_stem

View solution in original post

0 Karma

sowings
Splunk Employee
Splunk Employee

Start with a subsearch to find the top 10 URIs, then run a search to find average time:

[ search sourcetype=iis | fields cs_uri_stem | top limit=10 showperc=f showcount=f cs_uri_stem ]
sourcetype = iis | fields cs_uri_stem time_taken | chart avg(time_taken) by cs_uri_stem
0 Karma

jevenson
Path Finder

This is exactly what I needed. Thanks!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...