Splunk Search

Sorting the months by calender in splunk

ncbshiva
Communicator

Hi

how to sort the months according to the calender

This is the search query
source="D:\AVERAGE_CLOSE_TIME.csv" NOT "Month"| stats avg(Avg_Close_Time) as "Average Close Time in Days" by Month

This is the output
1 Apr-12 29.000000
2 Aug-12 18.000000
3 Dec-12 22.000000
4 Feb-12 36.000000

Tags (1)
0 Karma

jonuwz
Influencer

Convert your date fieldinto an epoch value 1st, so that it can be sorted.

Then fieldformat the results so they are displayed however you want

... | eval Month=strptime("01-".Month,"%d-%b-y")
    | fieldformat Month=strftime(Month,"%b-%y")

Should work out for you

ncbshiva
Communicator

yes i have added , but i am getting "No results found"

0 Karma

jonuwz
Influencer

just add what I posted to the end of your search ( minus the ... at the beginning )

0 Karma

ncbshiva
Communicator

Sorry i did'nt get , can u tell me in detail......?

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 ...