Splunk Search

How to sort a column chart to view the top 10 values?

bogdan_nicolesc
Communicator

Hi,

I try to make a column chart using this search:

index=webtrafic 
| rename ProcessName AS RootObject.ProcessName timestamp AS RootObject.timestamp
| fields "_time" "sourcetype" "RootObject.ProcessName" "RootObject.timestamp"
| stats dedup_splitvals=t count(RootObject.timestamp) AS "Count of timestamp"  by RootObject.ProcessName
| sort limit=5 RootObject.ProcessName
| fields - _span
| rename RootObject.ProcessName AS ProcessName
| fillnull "Count of timestamp"
| fields ProcessName, "Count of timestamp"

And i get this:

alt text

My question is: How can i sort columns so i can see top 5/10 highest values?

Thank you,
Bogdan

0 Karma

bogdan_nicolesc
Communicator

Hi marycordova,

If i use this command, i get this error:

Error in 'chart' command: The specifier 'Count of timestamp' is invalid. It must be in form (). For example: max(size).
The search job has failed due to an error. You may be able view the job in the Job Inspector.

if, however, i use this command:

(index=* OR index=_*) (index=webtrafic)
| rename ProcessName AS RootObject.ProcessName timestamp AS RootObject.timestamp
| fields "_time" "sourcetype" "RootObject.ProcessName" "RootObject.timestamp"
| stats dedup_splitvals=t count(RootObject.timestamp) AS "Count of timestamp"  by RootObject.ProcessName
| sort limit=100000 RootObject.ProcessName
| fields - _span
| rename RootObject.ProcessName AS ProcessName
| fillnull "Count of timestamp"
| fields ProcessName, "Count of timestamp"
| sort -"Count of timestamp"

I get this:

alt text

Thank you.
Bogdan

0 Karma

marycordova
SplunkTrust
SplunkTrust
index=webtrafic 
| stats dedup_splitvals=t count(timestamp) AS "Count of timestamp"  by ProcessName
| fillnull "Count of timestamp" value="0"
| sort - "Count of timestamp"
| head 5
| chart "Count of timestamp" by ProcessName
@marycordova
0 Karma
Get Updates on the Splunk Community!

Build Your First SPL2 App!

Watch the recording now!.Do you want to SPL™, too? SPL2, Splunk's next-generation data search and preparation ...

Exporting Splunk Apps

Join us on Monday, October 21 at 11 am PT | 2 pm ET!With the app export functionality, app developers and ...

[Coming Soon] Splunk Observability Cloud - Enhanced navigation with a modern look and ...

We are excited to introduce our enhanced UI that brings together AppDynamics and Splunk Observability. This is ...