<?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 do you dynamically generate month name based on a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-dynamically-generate-month-name-based-on-a-search/m-p/422758#M121394</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count AS [| makeresults | eval month=strftime(relative_time(now(), "@m"), "%B") | return $month ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You may need to change &lt;CODE&gt;@m&lt;/CODE&gt; to &lt;CODE&gt;-1m@m&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Mar 2019 03:06:51 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-03-06T03:06:51Z</dc:date>
    <item>
      <title>How do you dynamically generate month name based on a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-dynamically-generate-month-name-based-on-a-search/m-p/422756#M121392</link>
      <description>&lt;P&gt;I have created a Month over Month dashboard that will eventually become a report that is sent on the 1st day of the month, every month.  Is it possible to dynamically generate the month name from the search? Assuming this is run on March 1st, my search contains the following for the time frames:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Previous Month (January) -  earliest=-2month@month latest=-1month@month
Current Month (February) - earliest=-1month@month latest=@month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I use these, or some other command, to generate the month names to use as column headers? &lt;/P&gt;

&lt;P&gt;I'm currently using: "stats count as January" and "stats count as February" in the search, but I would like to remove those, so I don't have to edit the search for the proper month names each month. &lt;/P&gt;

&lt;P&gt;Let me know if you need more information.&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;Rk.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 00:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-dynamically-generate-month-name-based-on-a-search/m-p/422756#M121392</guid>
      <dc:creator>rwarnerii</dc:creator>
      <dc:date>2019-03-06T00:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do you dynamically generate month name based on a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-dynamically-generate-month-name-based-on-a-search/m-p/422757#M121393</link>
      <description>&lt;P&gt;hello &lt;/P&gt;

&lt;P&gt;use this for every search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;your_index&amp;gt; earliest=-2month@month latest=-1month@month date_month=* 
| stats count by date_month 
| transpose header_field=date_month 
| fields - column
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this is common :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by date_month 
| transpose header_field=date_month 
| fields - column
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 01:45:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-dynamically-generate-month-name-based-on-a-search/m-p/422757#M121393</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-03-06T01:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do you dynamically generate month name based on a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-dynamically-generate-month-name-based-on-a-search/m-p/422758#M121394</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | stats count AS [| makeresults | eval month=strftime(relative_time(now(), "@m"), "%B") | return $month ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You may need to change &lt;CODE&gt;@m&lt;/CODE&gt; to &lt;CODE&gt;-1m@m&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2019 03:06:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-dynamically-generate-month-name-based-on-a-search/m-p/422758#M121394</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-03-06T03:06:51Z</dc:date>
    </item>
  </channel>
</rss>

