<?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: Why am I unable to display only results for last month? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-display-only-results-for-last-month/m-p/255490#M76497</link>
    <description>&lt;P&gt;Thanks it works very well ! &lt;/P&gt;</description>
    <pubDate>Thu, 01 Oct 2015 19:31:25 GMT</pubDate>
    <dc:creator>clairebesson</dc:creator>
    <dc:date>2015-10-01T19:31:25Z</dc:date>
    <item>
      <title>Why am I unable to display only results for last month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-display-only-results-for-last-month/m-p/255488#M76495</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;I have a field that is a date. It’s written: &lt;CODE&gt;month/day/year&lt;/CODE&gt;. I have redefined this field as _time. &lt;BR /&gt;
So, I am able to count by month, however, when I want to see only the result for last month it didn’t work.&lt;/P&gt;

&lt;P&gt;Here is the code to display count by month:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Active.csv" | bucket span=1mon _time | eval extracted_date_field = strptime('FirstDate', "%m/%d/%Y") | eval _time = 'extracted_date_field'|  eval w_month=strftime(_time, "%b/%Y")|chart count by w_month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To display only the last month I tried this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="Active.csv" earliest=-1month@month | bucket span=1mon _time | eval extracted_date_field = strptime('FirstDate', "%m/%d/%Y") | eval _time = 'extracted_date_field'|  eval week_month=strftime(_time, "%b/%Y")|chart count by week_month
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the results are wrong...&lt;BR /&gt;
Could you please help me with that ? Thanks ! &lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 18:43:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-display-only-results-for-last-month/m-p/255488#M76495</guid>
      <dc:creator>clairebesson</dc:creator>
      <dc:date>2015-10-01T18:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to display only results for last month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-display-only-results-for-last-month/m-p/255489#M76496</link>
      <description>&lt;P&gt;The time range that you applied on second query (using earliest) is only applicable to _time before your overwrite it with FirstDate field. It seems like the data from Active.csv in last 1 month, doesn't contains any dates for previous month. Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="Active.csv" | bucket span=1mon _time | eval extracted_date_field = strptime('FirstDate', "%m/%d/%Y") | eval _time = 'extracted_date_field' | where _time&amp;gt;relative_time(now(),"-1month@month") |  eval w_month=strftime(_time, "%b/%Y")|chart count by w_month
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Oct 2015 19:01:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-display-only-results-for-last-month/m-p/255489#M76496</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-10-01T19:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to display only results for last month?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-display-only-results-for-last-month/m-p/255490#M76497</link>
      <description>&lt;P&gt;Thanks it works very well ! &lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2015 19:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-display-only-results-for-last-month/m-p/255490#M76497</guid>
      <dc:creator>clairebesson</dc:creator>
      <dc:date>2015-10-01T19:31:25Z</dc:date>
    </item>
  </channel>
</rss>

