|
We have a timechart that plots the number of entries of a specific type per day. The types are numerical (2, 3, 4...10, 11 at the moment). Right now, doing a "timechart count by type" produces the type of chart we want, except that the first two series are 10 and 11 (so it is being ordered 10, 11, 2, 3, 4, 5, etc...) How do I reorder the search so that the series emerge in numerical order instead of lexicographical? |
|
Have you tried this route?: (From: http://www.splunk.com/base/Documentation/latest/SearchReference/Sort ) the sort command will sort the rows by a field called 'type', but in a split-by clause like this the type values are columns. So this question is really about sorting columns not rows.
(21 Apr '11, 00:33)
sideview ♦
|
|
1) If the numbers really are quite small it's probably best to just use the fields command to reorder them.
2) or you could look into the 3) if the numbers are NOT small, you dont want to have a fields command that lists every integer, and you dont mind bucketing the split-by field a little, you can use this:
Not many people know this, but if you put a bins argument after a split-by term, it actually buckets the split-by term.... So you end up with column values like "10-20", "20-30", "30-40", "40-50" etc... This may not be what you're looking for, but it has the nice side effect of sorting the buckets numerically. |
|
Or prefix type with zero. ... | eval type=if(type<10,"0"+type,type) | timechart ... |
|
The way we found to do this was with a subsearch and
Probably a more efficient way out there, but this seems to work. |