<?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: Date field comparison in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Date-field-comparison/m-p/582044#M202744</link>
    <description>&lt;P&gt;Dates can only be compared in integer form.&amp;nbsp; Use the &lt;FONT face="courier new,courier"&gt;strptime&lt;/FONT&gt; function to convert them to integers and then compare them.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=devices
| eval last24h=relative_time(now(), "-1d")
| eval dls = strptime(device_last_seen, "%Y-%m-%dT%H:%M:%S%Z")
| where dls &amp;gt; last24h
| table device_last_seen&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jan 2022 16:24:26 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2022-01-21T16:24:26Z</dc:date>
    <item>
      <title>Date field comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-field-comparison/m-p/582007#M202734</link>
      <description>&lt;P&gt;I need help regarding comparise a ISO 8601 date field with a specific date.&lt;/P&gt;&lt;P&gt;Below is a simple example:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;index=devices | table device_last_seen&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Results&lt;/EM&gt;:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;device_last_seen&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;2022-01-21T13:09:58Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;2022-01-21T13:10:06Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;2022-01-17T14:56:00Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;2022-01-16T10:57:18Z&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My goal is to show only the devices reported in the last 24h. It should be like this:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="100%"&gt;device_last_seen&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;2022-01-21T13:09:58Z&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="100%"&gt;2022-01-21T13:10:06Z&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However the search below didn´t return any results.&lt;/P&gt;&lt;P&gt;index=devices&lt;BR /&gt;| eval last24h=relative_time(now(), "-1d")&lt;BR /&gt;| where device_last_seen &amp;gt; last24h&lt;BR /&gt;| table device_last_seen&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank in advance for your help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 14:05:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-field-comparison/m-p/582007#M202734</guid>
      <dc:creator>alexandrebas</dc:creator>
      <dc:date>2022-01-21T14:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date field comparison</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Date-field-comparison/m-p/582044#M202744</link>
      <description>&lt;P&gt;Dates can only be compared in integer form.&amp;nbsp; Use the &lt;FONT face="courier new,courier"&gt;strptime&lt;/FONT&gt; function to convert them to integers and then compare them.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=devices
| eval last24h=relative_time(now(), "-1d")
| eval dls = strptime(device_last_seen, "%Y-%m-%dT%H:%M:%S%Z")
| where dls &amp;gt; last24h
| table device_last_seen&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jan 2022 16:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Date-field-comparison/m-p/582044#M202744</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-01-21T16:24:26Z</dc:date>
    </item>
  </channel>
</rss>

