<?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: Events older then 30 days in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83456#M21250</link>
    <description>&lt;P&gt;Make sure that the spelling of "lastOccurrence" is correct in your search command.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jun 2012 15:17:01 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2012-06-27T15:17:01Z</dc:date>
    <item>
      <title>Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83452#M21246</link>
      <description>&lt;P&gt;The following is a sample entry from a splunk index...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lastOccurrence=2012-06-25 18:42:38.0|firstOccurrence=2012-06-18 14:45:59.0|writeTime=2012/06/25 18:40:55|actionCode=U|actionTime=2012-06-25 18:42:39.0|serverName=SERVER1|serverSerial=300998|identifier=10.169.255.trap61 server1.mydomain.com Host State - UP/DOWN|severity=0|alertText=PING OK - Packet loss = 0%, RTA = 0.03 ms|businessUnit=HQ|cmName=server.mydomain.com|deletedBy=|dmName=None|hostGroup=|msgSrc=Nagios|nagios_duration=0d 0h 0m 0s|netcool_duration=|productName=PRIMARY SERVICES|serviceName=Host State - UP/DOWN|supportGroup=SYSADMIN|tally=8200|tgtHostname=server1.mydomin.com|ticketNumber=
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I extract events that are older then 30 days based on the lastOccurance field.  Note the format of the field, I'm not concerned with the hours, minutes, or seconds.  &lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2012 18:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83452#M21246</guid>
      <dc:creator>DTERM</dc:creator>
      <dc:date>2012-06-25T18:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83453#M21247</link>
      <description>&lt;P&gt;Isn't the lastOccurrence field already extracted as the timestamp Splunk uses itself?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2012 19:09:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83453#M21247</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-06-25T19:09:10Z</dc:date>
    </item>
    <item>
      <title>Re: Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83454#M21248</link>
      <description>&lt;P&gt;I agree with Ayn - you might be able to search based on the splunk timestamp; the search would look like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=yourfilename latest=-30d@d earliest=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, if you really want to search based on the lastOccurance field:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lastOccurence=*
| eval testDate=strptime(lastOccurence,"%Y-%m-%d")
| where testDate &amp;lt; relative_time(now(),"-30d@d")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Duh - I cannot type sometimes. It is probably the spelling.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2012 23:20:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83454#M21248</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-06-25T23:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83455#M21249</link>
      <description>&lt;P&gt;That does not work.  Not sure why, but it does not work.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2012 15:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83455#M21249</guid>
      <dc:creator>DTERM</dc:creator>
      <dc:date>2012-06-27T15:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83456#M21250</link>
      <description>&lt;P&gt;Make sure that the spelling of "lastOccurrence" is correct in your search command.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2012 15:17:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83456#M21250</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-06-27T15:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83457#M21251</link>
      <description>&lt;P&gt;Does it give you any data? What do you get if you run this instead?&lt;/P&gt;

&lt;P&gt;lastOccurence=*&lt;BR /&gt;
| eval testDate=strptime(lastOccurence,"%Y-%m-%d")&lt;BR /&gt;
| eval lastMo = relative_time(now(),"-30d@d")&lt;BR /&gt;
| where testDate &amp;lt; lastMo&lt;BR /&gt;
| table testDate lastMo lastOccurence&lt;/P&gt;

&lt;P&gt;(And you might have to leave off the where command if you aren't getting any data)&lt;BR /&gt;
- Updated for spelling -&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2012 15:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83457#M21251</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-06-27T15:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83458#M21252</link>
      <description>&lt;P&gt;this one works, thx !!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 11:24:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83458#M21252</guid>
      <dc:creator>ecanmaster</dc:creator>
      <dc:date>2017-12-22T11:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: Events older then 30 days</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83459#M21253</link>
      <description>&lt;P&gt;I had to add an additional eval to get mine to work but this is the answer I've been searching for for a while. Thank you!&lt;/P&gt;

&lt;P&gt;|eval test=relative_time(now(),"-90d@d")&lt;BR /&gt;
|eval test2=strftime(test,"%Y-%m-%d")&lt;BR /&gt;
|where StartDate &amp;gt; test2&lt;/P&gt;</description>
      <pubDate>Wed, 09 May 2018 18:05:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Events-older-then-30-days/m-p/83459#M21253</guid>
      <dc:creator>meganarellano</dc:creator>
      <dc:date>2018-05-09T18:05:37Z</dc:date>
    </item>
  </channel>
</rss>

