<?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: Unix Time Math for a Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Unix-Time-Math-for-a-Field/m-p/56711#M13892</link>
    <description>&lt;P&gt;I'm assuming &lt;CODE&gt;my_unix_time&lt;/CODE&gt; is &lt;EM&gt;not&lt;/EM&gt; equal to the event timestamp?&lt;/P&gt;</description>
    <pubDate>Sun, 26 Sep 2010 07:22:58 GMT</pubDate>
    <dc:creator>gkanapathy</dc:creator>
    <dc:date>2010-09-26T07:22:58Z</dc:date>
    <item>
      <title>Unix Time Math for a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unix-Time-Math-for-a-Field/m-p/56709#M13890</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I currently am doing a search that uses a unix time as a field.  What I want to do, is do something like this at search time:&lt;/P&gt;

&lt;P&gt;source="mysource" my_unix_time &amp;lt; (unix_time(now)-6 Months)&lt;/P&gt;

&lt;P&gt;Effectively, I want to say, keep only entries where this field's date time is greater than six months (not the actual time the data was logged, this specific field).  I am converting the unix time to something readable with convert timeformat="%Y-%m-%d %H:%M:%S" ctime(my_unix_time) so I am not sure if date manipulation is easier after this or before.&lt;/P&gt;

&lt;P&gt;Thanks for any help.&lt;/P&gt;

&lt;P&gt;Kevin&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2010 20:21:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unix-Time-Math-for-a-Field/m-p/56709#M13890</guid>
      <dc:creator>kholleran</dc:creator>
      <dc:date>2010-09-23T20:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unix Time Math for a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unix-Time-Math-for-a-Field/m-p/56710#M13891</link>
      <description>&lt;P&gt;If you are running 4.1 you can use the &lt;CODE&gt;relative_time()&lt;/CODE&gt; eval function, so your expression could be written:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="mysource" | where my_unix_time &amp;lt; relative_time(time(), "-6mon") | convert timeformat="%Y-%m-%d %H:%M:%S" ctime(my_unix_time)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that &lt;CODE&gt;time()&lt;/CODE&gt; is the wall-clock time, where as the &lt;CODE&gt;now()&lt;/CODE&gt; eval function is based on the time when the search was started (or was scheduled to start).&lt;/P&gt;

&lt;P&gt;Docs:
&lt;A href="http://www.splunk.com/base/Documentation/latest/SearchReference/CommonEvalFunctions" rel="nofollow"&gt;Functions for eval and where&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2010 21:48:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unix-Time-Math-for-a-Field/m-p/56710#M13891</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-09-23T21:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Unix Time Math for a Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Unix-Time-Math-for-a-Field/m-p/56711#M13892</link>
      <description>&lt;P&gt;I'm assuming &lt;CODE&gt;my_unix_time&lt;/CODE&gt; is &lt;EM&gt;not&lt;/EM&gt; equal to the event timestamp?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Sep 2010 07:22:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Unix-Time-Math-for-a-Field/m-p/56711#M13892</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-09-26T07:22:58Z</dc:date>
    </item>
  </channel>
</rss>

