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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...