Refine your search:

I am building a search to find the average amount of time an action takes:

sourcetype="timelog" | stats avg(request_duration) by requested_file

However, I would also like to see the number of hits represented in that average which I would intuitively write like so:

sourcetype="timelog" | stats avg(request_duration), count(request_duration) by requested_file

Of course, this is invalid syntax because stats only allows one input column.

What is the proper way to write this search?

asked 15 Jul '10, 01:18

isnoop's gravatar image

isnoop
1111
accept rate: 0%


One Answer:

The stats command allows many input columns and many aggregation functions on any or all of them. The above syntax is valid and correct for what you have stated.

link

answered 15 Jul '10, 03:43

gkanapathy's gravatar image

gkanapathy ♦
32.6k4827
accept rate: 41%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1,685
×281
×152

Asked: 15 Jul '10, 01:18

Seen: 3,213 times

Last updated: 15 Jul '10, 03:43

Copyright © 2005-2012 Splunk Inc. All rights reserved.