Splunk Search

How to Sort the "count by..." results

arkonner
Path Finder

I am using the search below for the locked out accounts - Should be possible to sort the result by the user with high number

Thank you in advance

`windowsindex` `windowssourcetype` "EventCode=644" OR "EventCode=4740" | eval Win2K8_acc = mvindex(Account_Name,1) | eval "Locked_Account"=coalesce(Win2K8_acc,Target_Account_Name) | timechart count by Locked_Account
Tags (4)
1 Solution

javiergn
Super Champion

Do you need the timechart or a simple table would do the job?
If so:

windowsindex windowssourcetype "EventCode=644" OR "EventCode=4740"
| eval Win2K8_acc = mvindex(Account_Name,1) 
| eval "Locked_Account"=coalesce(Win2K8_acc,Target_Account_Name) 
| top limit=0 Locked_Account

View solution in original post

0 Karma

javiergn
Super Champion

Do you need the timechart or a simple table would do the job?
If so:

windowsindex windowssourcetype "EventCode=644" OR "EventCode=4740"
| eval Win2K8_acc = mvindex(Account_Name,1) 
| eval "Locked_Account"=coalesce(Win2K8_acc,Target_Account_Name) 
| top limit=0 Locked_Account
0 Karma

arkonner
Path Finder

Hi,

I need a Timechart with the User legend sorted by user with highest number of locked-out instead of legend sort in alphabetic order.

0 Karma

javiergn
Super Champion

That is a bit more complicated mainly because you don't have the totals per user and time in the same table.

The following might give you the best of both worlds:

windowsindex windowssourcetype "EventCode=644" OR "EventCode=4740"
| eval Win2K8_acc = mvindex(Account_Name,1) 
| eval "Locked_Account"=coalesce(Win2K8_acc,Target_Account_Name) 
| timechart count by Locked_Account
| untable _time Locked_Account count
| eventstats sum(count) as total_count by Locked_Account
| xyseries _time Locked_Account count total_count

Let me know if that helps

0 Karma

arkonner
Path Finder

your search duplicate the results as "count" and "total_count" reporting and the user list is empty

Using the search below whit a "line chart" the Legend is in alphabetic order - I am looking to sort the legend from the user with the highest number of locked-out events.

 `windowsindex` `windowssourcetype` "EventCode=644" OR "EventCode=4740" | eval Win2K8_acc = mvindex(Account_Name,1) | eval "Locked_Account"=coalesce(Win2K8_acc,Target_Account_Name) | timechart count by Locked_Account
0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...