Splunk Search

How to sort chart columns where the column headers are field values?

zd00191
Communicator

I have the following search.

index=ko_autosys sourcetype=autosys_applog_scheduler_events  host="usatlb98" OR host="usatlb91" System="*"  JOB_NAME="*" eventtype=autosys_failure_jobs OR eventtype=autosys_terminated_jobs OR eventtype=autosys_restart_jobs OR eventtype=autosys_success_jobs  |chart  count(JOB_NAME) over System by job_status 

It displays a table with the following columns: System, FAILURE, RESTART, TERMINATED, SUCCESS

I want to sort by the FAILURE Column where the System with the largest number of failures is on top. The issue is that FAILURE SUCCESS TERMINATED and RESTART are field values, not field names.

Please help. Thanks!

0 Karma
1 Solution

woodcock
Esteemed Legend

Assuming that FAILURE is a value of field job_status then your statement is incorrect. Using chart the way you show will cause a column (field) to be created named FAILURE so you should be able to do it like this:

index=ko_autosys sourcetype=autosys_applog_scheduler_events host="usatlb98" OR host="usatlb91" System="*" JOB_NAME="*" eventtype=autosys_failure_jobs OR eventtype=autosys_terminated_jobs OR eventtype=autosys_restart_jobs OR eventtype=autosys_success_jobs | chart  count(JOB_NAME) over System by job_status | sort 0 -FAILURE

View solution in original post

woodcock
Esteemed Legend

Assuming that FAILURE is a value of field job_status then your statement is incorrect. Using chart the way you show will cause a column (field) to be created named FAILURE so you should be able to do it like this:

index=ko_autosys sourcetype=autosys_applog_scheduler_events host="usatlb98" OR host="usatlb91" System="*" JOB_NAME="*" eventtype=autosys_failure_jobs OR eventtype=autosys_terminated_jobs OR eventtype=autosys_restart_jobs OR eventtype=autosys_success_jobs | chart  count(JOB_NAME) over System by job_status | sort 0 -FAILURE
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 ...