<?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: Does date_hour work properly in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118848#M184018</link>
    <description>&lt;P&gt;I had this inconsistent behavior for appendcols as well. I replaced the appendcols with join and was able to get more consistent result with data in same format. Try below and let me know if it helped.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="access_combined_wcookie" (uri=/submitOrder) earliest=-7d@d latest=-6d@d | stats count as LastWeek by date_hour | join type=outer date_hour [search sourcetype="access_combined_wcookie" (uri=/submitOrder) earliest=@d latest=now | stats count as Today by date_hour]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Oct 2013 23:51:43 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2013-10-28T23:51:43Z</dc:date>
    <item>
      <title>Does date_hour work properly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118847#M184017</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am getting order count today by hour vs last week same day by hour and having a column chart. This works fine most of the times but some times counts are wrong for the sub query. It looks like the counts are being shifted. For example, 9th hour shows 6th hour counts, etc. This does not happpen all the time but don't know why this happens some times. Any idea? &lt;/P&gt;

&lt;P&gt;sourcetype="access_combined_wcookie"  (uri=&lt;EM&gt;/submitOrder&lt;/EM&gt;)  earliest=-7d@d latest=-6d@d  | stats count as LastWeek by date_hour | appendcols [search sourcetype="access_combined_wcookie"  (uri=&lt;EM&gt;/submitOrder&lt;/EM&gt;)  earliest=@d latest=now  | stats count as Today by date_hour]&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:06:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118847#M184017</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2020-09-28T15:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Does date_hour work properly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118848#M184018</link>
      <description>&lt;P&gt;I had this inconsistent behavior for appendcols as well. I replaced the appendcols with join and was able to get more consistent result with data in same format. Try below and let me know if it helped.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="access_combined_wcookie" (uri=/submitOrder) earliest=-7d@d latest=-6d@d | stats count as LastWeek by date_hour | join type=outer date_hour [search sourcetype="access_combined_wcookie" (uri=/submitOrder) earliest=@d latest=now | stats count as Today by date_hour]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Oct 2013 23:51:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118848#M184018</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-10-28T23:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Does date_hour work properly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118849#M184019</link>
      <description>&lt;P&gt;It could perhaps be due to the fact that the &lt;CODE&gt;date_*&lt;/CODE&gt; fields are extracted as-is from the events, and do not take timezones into consideration (which &lt;CODE&gt;_time&lt;/CODE&gt;) does.&lt;/P&gt;

&lt;P&gt;Thus you might be better off with extracting this information yourself with&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| eval hr=strftime(_time, "%H")|&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;before the &lt;CODE&gt;stats&lt;/CODE&gt; (in both inner and outer searches). Then use &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;by hr&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;instead of &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;by date_hour&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 00:25:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118849#M184019</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-29T00:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Does date_hour work properly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118850#M184020</link>
      <description>&lt;P&gt;Thank you. It seems to be working fine. I have to wait few days to see if i get the behavior again. Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 03:52:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118850#M184020</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-10-29T03:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Does date_hour work properly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118851#M184021</link>
      <description>&lt;P&gt;Hi Kristian, Thanks for your suggestion. I tried it and it showed the same behavior. Looks like it is due to appendcols as per below answer.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 03:53:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118851#M184021</guid>
      <dc:creator>xvxt006</dc:creator>
      <dc:date>2013-10-29T03:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Does date_hour work properly</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118852#M184022</link>
      <description>&lt;P&gt;You have read the documentation for &lt;CODE&gt;appendcols&lt;/CODE&gt;, right?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Synopsis

Appends the fields of the subsearch results to current results, first results to first result, second to second, etc. 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there are no results for a certain time slot in either of the searches, the results would be shifted, as per documentation.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Appendcols"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Appendcols&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2013 07:02:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Does-date-hour-work-properly/m-p/118852#M184022</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-29T07:02:49Z</dc:date>
    </item>
  </channel>
</rss>

