<?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: Extract data between multiple days.. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-between-multiple-days/m-p/484851#M135723</link>
    <description>&lt;P&gt;Perhaps this will get you started.  It produces a 'period' field that you should be able to use for other purposes.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo earliest=-720d latest=now
| eval epoch = strptime (acd_date, "&amp;lt;format of the acd_date field&amp;gt;")
| eval period = case(epoch &amp;lt; relative_time(now(), "-32d"), "1-32", epoch &amp;lt; relative_time(now(), "-42d"), "&amp;gt;32",
epoch &amp;lt; relative_time(now(), "-72d"), "&amp;gt;42", epoch &amp;lt; relative_time(now(), "-365d"), "&amp;lt;365", 1==1, "&amp;lt;720")
| ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 29 Apr 2020 20:38:18 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-04-29T20:38:18Z</dc:date>
    <item>
      <title>Extract data between multiple days..</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-between-multiple-days/m-p/484850#M135722</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I am just trying to write a spluNk query to extract data between 1-32 days , &amp;gt;32 days , &amp;gt; 42 days , &amp;gt; 72 days , &amp;lt; 365 days and &amp;lt; 720 days&lt;/P&gt;

&lt;P&gt;I tried multiple queries and I believe it's possible with the case statement . Kindly suggest on this. &lt;/P&gt;

&lt;P&gt;Note : I just have one custom field acd_date which I should use in my case statement.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 20:18:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-between-multiple-days/m-p/484850#M135722</guid>
      <dc:creator>Inayath_khan</dc:creator>
      <dc:date>2020-04-29T20:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data between multiple days..</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-between-multiple-days/m-p/484851#M135723</link>
      <description>&lt;P&gt;Perhaps this will get you started.  It produces a 'period' field that you should be able to use for other purposes.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo earliest=-720d latest=now
| eval epoch = strptime (acd_date, "&amp;lt;format of the acd_date field&amp;gt;")
| eval period = case(epoch &amp;lt; relative_time(now(), "-32d"), "1-32", epoch &amp;lt; relative_time(now(), "-42d"), "&amp;gt;32",
epoch &amp;lt; relative_time(now(), "-72d"), "&amp;gt;42", epoch &amp;lt; relative_time(now(), "-365d"), "&amp;lt;365", 1==1, "&amp;lt;720")
| ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Apr 2020 20:38:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-between-multiple-days/m-p/484851#M135723</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-04-29T20:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data between multiple days..</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-between-multiple-days/m-p/484852#M135724</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults count=2 
| streamstats count 
| eval _time=if(count=2,relative_time(_time,(-1*count)."y@y"),_time) 
| makecontinuous span=1d _time 
| timechart count span=1d
| eval diff=tostring(now() - _time,"duration")
| rex field=diff "(?&amp;lt;daysAgo&amp;gt;\d+)\+"
| fillnull daysAgo
| eval acd_date=case(daysAgo &amp;lt;= 32 ,"less32days" , daysAgo &amp;lt;= 42, "less42days",  daysAgo &amp;lt;= 72,"less72days" , daysAgo &amp;lt;= 365,"less1year", daysAgo &amp;lt;= 720,"less2years",true(), "over2years")
| dedup acd_date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's all about order.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 20:54:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-between-multiple-days/m-p/484852#M135724</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-29T20:54:50Z</dc:date>
    </item>
  </channel>
</rss>

