<?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 _time is different than timestamp in events, searching by business hours in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/time-is-different-than-timestamp-in-events-searching-by-business/m-p/378728#M111014</link>
    <description>&lt;P&gt;I have events that with timestamp fields that look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;date="6/21/2019 6:50:49 PM"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I change my search so that only events during business hours appear? I only want events with timestamps between 6am and 6pm.&lt;/P&gt;

&lt;P&gt;I have tried the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval date_hour=strftime(_time, "%w") | search date_hour&amp;gt;=6 date_hour&amp;lt;=18
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the _time field is listed is this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;6/21/19
10:51:09.000 AM
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see the _time field is about 8 hours earlier than the timestamp in my event and when I search using the _time field, my results are off by 8 hours.&lt;/P&gt;

&lt;P&gt;Is there a way to search using the timestamps in my events rather than the _time field? Or can I adjust the _time field to increase by 8 hours so the hours match?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jul 2019 23:15:18 GMT</pubDate>
    <dc:creator>brandonbachman</dc:creator>
    <dc:date>2019-07-03T23:15:18Z</dc:date>
    <item>
      <title>_time is different than timestamp in events, searching by business hours</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-is-different-than-timestamp-in-events-searching-by-business/m-p/378728#M111014</link>
      <description>&lt;P&gt;I have events that with timestamp fields that look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;date="6/21/2019 6:50:49 PM"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I change my search so that only events during business hours appear? I only want events with timestamps between 6am and 6pm.&lt;/P&gt;

&lt;P&gt;I have tried the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval date_hour=strftime(_time, "%w") | search date_hour&amp;gt;=6 date_hour&amp;lt;=18
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the _time field is listed is this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;6/21/19
10:51:09.000 AM
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you can see the _time field is about 8 hours earlier than the timestamp in my event and when I search using the _time field, my results are off by 8 hours.&lt;/P&gt;

&lt;P&gt;Is there a way to search using the timestamps in my events rather than the _time field? Or can I adjust the _time field to increase by 8 hours so the hours match?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 23:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-is-different-than-timestamp-in-events-searching-by-business/m-p/378728#M111014</guid>
      <dc:creator>brandonbachman</dc:creator>
      <dc:date>2019-07-03T23:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: _time is different than timestamp in events, searching by business hours</title>
      <link>https://community.splunk.com/t5/Splunk-Search/time-is-different-than-timestamp-in-events-searching-by-business/m-p/378729#M111015</link>
      <description>&lt;P&gt;The time picker only considers _time.  You can, however, search for other time fields.  Here's one way, but I'm sure there are others.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo | eval ts=strptime(date,"%m/%d/%Y %H:%M:%S %p") 
| eval start=relative_time(ts,"@d+6h"), end=relative_time(ts,"@d+18h")
| search ts&amp;gt;=start AND ts&amp;lt;end
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jul 2019 01:50:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/time-is-different-than-timestamp-in-events-searching-by-business/m-p/378729#M111015</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-07-04T01:50:15Z</dc:date>
    </item>
  </channel>
</rss>

