Splunk Search

data is displayed by alphabetic order of the month name when using date_month to sort

zliu
Splunk Employee
Splunk Employee

In 4.2.x, instead of June, July, August, September, the data listed as August, July, June, September. Data is displayed by alphabetic order of the month name.

Data is displayed by alphabetic order of the month name when it should be logical.

* |stats count as "Total Incident/month" by date_month 

alt text

Tags (1)

ag
Explorer

I would change something slightly with gkanapathy's answer. Prefix the date_numeric_month with an underscore to make it hidden and add the month name within the query.

In this example I am getting the count of user_ids per month:

... | eval _date_numeric_month=strftime(_time,"%m") | stats count(user_id) by _date_numeric_month, date_month | sort _date_numeric_month

gkanapathy
Splunk Employee
Splunk Employee

This is not a bug. If you do want to sort by month, then you can place the month number in a field and sort on that, e.g.:

... | eval date_numericmonth=strftime(_time,"%m") | stats count by date_numericmonth

lakshayanand
New Member

what if i want to use chart command instead of stats. then how do i arrange months in chronological order?
Below is the query in which i want to arrange results by chronological order:
.
.....| eval month=strftime(strptime(UpdateDate,"%m/%d/%y %H:%M"),"%B")| chart sum(Effort) by month,date_year | sort month

0 Karma

zliu
Splunk Employee
Splunk Employee

This is a bug. Bug#SPL-43691

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...