<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Chart data by month with sorting order in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585394#M203952</link>
    <description>&lt;P&gt;Thank you everyone for all of the help.&amp;nbsp; This is the solution I ended up utilizes as it was pointed out to me that we would be showing some months from previous year and would want to have them ordered correctly so needed to add in the year.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bin _time span=1mon 
| eval c_time=strftime(_time,"%Y-%m")
| chart count BY referrer_stem, c_time
| addtotals 
| rename "*-01" AS "*-Jan" "*-02" AS "*-Feb" "*-03" AS "*-Mar" "*-04" AS "*-Apr" "*-05" AS "*-May" "*-06" AS "*-Jun" "*-07" AS "*-Jul" "*-08" AS "*-Aug" "*-09" AS "*-Sep" "*-10" AS "*-Oct" "*-11" AS "*-Nov" "*-12" AS "*-Dec"
| sort 10 - Total
| fields - Total&lt;/LI-CODE&gt;&lt;P&gt;I also solved the issue of the sorting by totaling the rows and using that column to do the sort (this ALSO solved the fact of making sure I had to top used referrer_stems) and then just removing the field after the sort&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Feb 2022 16:26:57 GMT</pubDate>
    <dc:creator>jeffbat</dc:creator>
    <dc:date>2022-02-16T16:26:57Z</dc:date>
    <item>
      <title>How to chart data by month with sorting order?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585228#M203874</link>
      <description>&lt;P&gt;I am running into an issue when I am trying to get a chart to populate with the data as I am expecting.&lt;/P&gt;
&lt;P&gt;I am running a search where the data is from IIS logs where it parsing out the referrer_stem&amp;nbsp; and then counting the total of each referrer_stem per month.&amp;nbsp; I am also splitting out the month field by both the shortname and numerical value (for testing each on the sort).&lt;/P&gt;
&lt;P&gt;this is the end portion of my search:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval date_month=strftime(_time, "%b")
| eval number_month=strftime(_time, "%m")
| chart count BY referrer_stem, date_month
| sort 10 - count&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The issue I am having is if I do this with date_month field then it shows columns or bars out of order (i.e. it shows as Feb Jan) where as if I do it by number_month it is correct (i.e. 01 02).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I want it to show in the correct order but using the month's shortname.&lt;/P&gt;
&lt;P&gt;I did try to use a case statement when using number_month but that doesn't work because after the chart command the field name seems to not exist (or I just don't know how to access the right name).&lt;/P&gt;
&lt;P&gt;Any help&amp;nbsp; or insight on this would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 17:42:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585228#M203874</guid>
      <dc:creator>jeffbat</dc:creator>
      <dc:date>2022-02-16T17:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Chart data by month with sorting order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585229#M203875</link>
      <description>&lt;P&gt;Working with time strings is tricky. How should splunk know that "feb" shoud be after "jan"? It's before in lexicographical order.&lt;/P&gt;&lt;P&gt;If you want to sort by time, leave it as is - as a unix timestamp. Just do a fieldformat so it's displayed the way you want. If you want only some part of the date (like the month in your case), do binning.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 19:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585229#M203875</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-15T19:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to Chart data by month with sorting order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585263#M203886</link>
      <description>&lt;P&gt;Try something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval number_month=strftime(_time, "%m")
| chart count BY referrer_stem, number_month
| sort 10 - count
| rename "01" as "Jan", "02" as "Feb", and so on...&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VatsalJagani_0-1644991039591.png" style="width: 662px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/17991i0A9680E46DC7E8B7/image-dimensions/662x166?v=v2" width="662" height="166" role="button" title="VatsalJagani_0-1644991039591.png" alt="VatsalJagani_0-1644991039591.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;FYI, your sort - count will not work because as you can see in the screenshot when you will use the &lt;STRONG&gt;chart&lt;/STRONG&gt; command, you don't have a column called "count".&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 05:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585263#M203886</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-02-16T05:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Chart data by month with sorting order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585270#M203890</link>
      <description>&lt;P&gt;Ahh, I missed that it's about _column_order.&lt;/P&gt;&lt;P&gt;That's more tricky. If your column set is constant you simply add&lt;/P&gt;&lt;PRE&gt;| table columnA columnD columnC ...&lt;/PRE&gt;&lt;P&gt;at the end of your search and you have your order.&lt;/P&gt;&lt;P&gt;If you however want columns in a particular order but don't know the exact names, transposing, sorting and transposing back is the way to go.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 06:20:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585270#M203890</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-02-16T06:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to Chart data by month with sorting order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585273#M203892</link>
      <description>&lt;P&gt;Yup, I missed a simpler solution. The table should also solve.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 06:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585273#M203892</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-02-16T06:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Chart data by month with sorting order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585275#M203893</link>
      <description>&lt;P&gt;Other way is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date_month=strftime(_time, "%b")
| chart count BY referrer_stem, date_month
| table referrer_stem, Jan, Feb, Mar, .....&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Feb 2022 06:27:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585275#M203893</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2022-02-16T06:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to Chart data by month with sorting order</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585394#M203952</link>
      <description>&lt;P&gt;Thank you everyone for all of the help.&amp;nbsp; This is the solution I ended up utilizes as it was pointed out to me that we would be showing some months from previous year and would want to have them ordered correctly so needed to add in the year.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| bin _time span=1mon 
| eval c_time=strftime(_time,"%Y-%m")
| chart count BY referrer_stem, c_time
| addtotals 
| rename "*-01" AS "*-Jan" "*-02" AS "*-Feb" "*-03" AS "*-Mar" "*-04" AS "*-Apr" "*-05" AS "*-May" "*-06" AS "*-Jun" "*-07" AS "*-Jul" "*-08" AS "*-Aug" "*-09" AS "*-Sep" "*-10" AS "*-Oct" "*-11" AS "*-Nov" "*-12" AS "*-Dec"
| sort 10 - Total
| fields - Total&lt;/LI-CODE&gt;&lt;P&gt;I also solved the issue of the sorting by totaling the rows and using that column to do the sort (this ALSO solved the fact of making sure I had to top used referrer_stems) and then just removing the field after the sort&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 16:26:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chart-data-by-month-with-sorting-order/m-p/585394#M203952</guid>
      <dc:creator>jeffbat</dc:creator>
      <dc:date>2022-02-16T16:26:57Z</dc:date>
    </item>
  </channel>
</rss>

