<?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: How to count daily events with specific time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291500#M163813</link>
    <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Use this for yesterday - 9 am to 12 midnight&lt;BR /&gt;
earliest=-1d@d+9h latest=-1d@d+24h&lt;/P&gt;

&lt;P&gt;&amp;amp; this for day before yesterday - 9 am to 12 midnight&lt;BR /&gt;
earliest=-2d@d+9h latest=-2d@d+24h&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2018 00:58:20 GMT</pubDate>
    <dc:creator>rakshithreddy</dc:creator>
    <dc:date>2018-01-09T00:58:20Z</dc:date>
    <item>
      <title>How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291498#M163811</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I need to count number of events daily starting from 9 am to 12 midnight. Currently I have "earliest=@d+9h latest=now" on my search.&lt;BR /&gt;
This works well if I select "Today" on the timepckr. However, if I select yesterday, it is still counting the events from today.&lt;/P&gt;

&lt;P&gt;how can I fix this?&lt;/P&gt;

&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 00:02:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291498#M163811</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-01-09T00:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291499#M163812</link>
      <description>&lt;P&gt;From the &lt;A href="https://answers.splunk.com/answers/607123/how-to-count-the-number-of-eventts-starting-at-9-a.html" target="_blank"&gt;other question&lt;/A&gt; you posted about this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; date_hour&amp;gt;=9
| timechart span=1h count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Splunk parses out the timestamp components (date_month, date_mday, date_hour, etc) for each event, so these fields are available to be a part of your base search.&lt;BR /&gt;
Or if you want the total count per day:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; date_hour&amp;gt;=9
| timechart span=1d count
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291499#M163812</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2020-09-29T17:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291500#M163813</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Use this for yesterday - 9 am to 12 midnight&lt;BR /&gt;
earliest=-1d@d+9h latest=-1d@d+24h&lt;/P&gt;

&lt;P&gt;&amp;amp; this for day before yesterday - 9 am to 12 midnight&lt;BR /&gt;
earliest=-2d@d+9h latest=-2d@d+24h&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 00:58:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291500#M163813</guid>
      <dc:creator>rakshithreddy</dc:creator>
      <dc:date>2018-01-09T00:58:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291501#M163814</link>
      <description>&lt;P&gt;Hi @micahkemp,&lt;/P&gt;

&lt;P&gt;Thanks for your reply.&lt;/P&gt;

&lt;P&gt;I need the per hour count and the total count per day.&lt;/P&gt;

&lt;P&gt;I used the below query for the per hour count but it's not working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; date_hour&amp;gt;=9
| timechart span=1h count(EVENT) as "Pallet Quantity"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 00:58:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291501#M163814</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-01-09T00:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291502#M163815</link>
      <description>&lt;P&gt;Hi @rakshithreddy,&lt;BR /&gt;
Thanks for your reply.&lt;BR /&gt;
I am using a timepkr that is why I can't use "earliest".&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 01:16:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291502#M163815</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-01-09T01:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291503#M163816</link>
      <description>&lt;P&gt;What was the search you ran?  I'm assuming you substituted where I indicated &lt;CODE&gt;&amp;lt;search&amp;gt;&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 01:53:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291503#M163816</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T01:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291504#M163817</link>
      <description>&lt;P&gt;Yes I did! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Here is the complete query, it works when I remove date_hour&amp;gt;=9&lt;/P&gt;

&lt;P&gt;index=bpi_sql sourcetype=DM_H_OUTBOUND_PALLET_CREATED_R date_hour&amp;gt;=9&lt;BR /&gt;
    | dedup TSUID &lt;BR /&gt;
    | timechart span=1H count as IDEVENT &lt;BR /&gt;
    | rename IDEVENT AS " PALLET QUANTITY"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:31:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291504#M163817</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2020-09-29T17:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291505#M163818</link>
      <description>&lt;P&gt;I certainly don't understand what your data looks like, which may be impacting my ability to come up with a solution.  A run-anywhere example of the concept is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal date_hour&amp;gt;=9
| timechart span=1h count AS IDEVENT
| rename IDEVENT AS "PALLET QUANTITY"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 02:08:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291505#M163818</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T02:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291506#M163819</link>
      <description>&lt;P&gt;The data do have a time log - 09/01/2018 11:04:52.000&lt;BR /&gt;
 and the functions earliest /latest does work. &lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 02:18:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291506#M163819</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-01-09T02:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291507#M163820</link>
      <description>&lt;P&gt;This should work, though I can't explain why date_hour didn't:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bpi_sql sourcetype=DM_H_OUTBOUND_PALLET_CREATED_R
| timechart span=1h count AS IDEVENT
| rename IDEVENT AS "PALLET QUANTITY"
| eval hour=strftime(_time, "%H")
| search hour&amp;gt;=9
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By the way, you shouldn't need to use &lt;CODE&gt;rename&lt;/CODE&gt;, you can just pick the name you want in your &lt;CODE&gt;timechart&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bpi_sql sourcetype=DM_H_OUTBOUND_PALLET_CREATED_R
| timechart span=1h count AS "PALLET QUANTITY"
| eval hour=strftime(_time, "%H")
| search hour&amp;gt;=9
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then if you want the total for the day:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=bpi_sql sourcetype=DM_H_OUTBOUND_PALLET_CREATED_R
| timechart span=1h count AS "PALLET QUANTITY"
| eval hour=strftime(_time, "%H")
| search hour&amp;gt;=9
| stats sum("PALLET QUANTITY")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 02:25:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291507#M163820</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T02:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to count daily events with specific time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291508#M163821</link>
      <description>&lt;P&gt;It worked!!&lt;BR /&gt;
Thanks a lot for your help and also for the advise about the rename! &lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 02:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-daily-events-with-specific-time/m-p/291508#M163821</guid>
      <dc:creator>auaave</dc:creator>
      <dc:date>2018-01-09T02:35:10Z</dc:date>
    </item>
  </channel>
</rss>

