Refine your search:

v4.3.1 linux

so apparently Splunk will not execute nested functions.

example | stats count,values(src),count(values(src)),values(event_desc) by error_code | sort - count

in my search "values(src)" returns a list of IP's, so "count(values(src))" should return a integer value indicating how many entries were in "values(src)". i get a "0" value.

ok, so it dont work, not sure if it should, but it dont, so whats the workaround for this?

asked 20 Mar '12, 12:52

cvajs's gravatar image

cvajs
24128
accept rate: 5%

edited 20 Mar '12, 13:11


One Answer:

You can't nest these, but you can do

stats count values(src) dc(src) values(event_desc) by error_code

dc stands for "distinct_count" which is the number of unique values for the field.

link

answered 20 Mar '12, 13:30

lguinn's gravatar image

lguinn ♦
11.0k5723
accept rate: 28%

edited 20 Mar '12, 22:24

great, i missied dc for some reason when reading stats in docs. thnx

also, how would you make a search to find top 5 error codes, then for each error code find the top 10 responsible IP, where the table lists error code, count by error code, top 10 IP for each error code, and, a count(src) by error_code # next to each of the 10 IP's ?

in english terms, give top 5 error_code events, for each event list top 10 IP's, for each IP list # of times it was responsible for generating the error_code.

(20 Mar '12, 13:52) cvajs

<yoursearch> [search <yoursearch> | top limit=5 error_code | fields + error_code] | top showperc=f ip by error_code

This does not give you a sub-total by error_code, but it does do all the rest... Substitute the appropriate search critera for <yoursearch> in both places...

(20 Mar '12, 22:24) lguinn ♦
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:

×266
×11
×2

Asked: 20 Mar '12, 12:52

Seen: 376 times

Last updated: 20 Mar '12, 22:24

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