<?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 get event count from current hour and previous hour by sourcetype and server/host in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407032#M117586</link>
    <description>&lt;P&gt;I updated the sourcetype index to 1 and it worked like a charm! Thank you @kamlesh_vaghela !&lt;/P&gt;</description>
    <pubDate>Tue, 09 Oct 2018 02:05:06 GMT</pubDate>
    <dc:creator>catherineang</dc:creator>
    <dc:date>2018-10-09T02:05:06Z</dc:date>
    <item>
      <title>How to get event count from current hour and previous hour by sourcetype and server/host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407030#M117584</link>
      <description>&lt;P&gt;The goal is to compare the events from this hour vs the past hour. And then display a table by sourcetype, host, percent, difference, current count, previous hour count.&lt;/P&gt;

&lt;P&gt;This is my query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=x sourcetype=* host=* earliest=-2h@h latest=now | eval period=if(_time&amp;gt;=relative_time(now(),"-1hr"),"current","previous") | chart count(sourcetype) over host by period | eval difference=current-previous | eval percent=(current/previous)*100| table sourcetype host percent difference current previous
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is,  sourcetype column is blank and host column and count appears. It doesn't count by sourcetype and host. If I do "chart count(host) over sourcetype by period", only the host column would be blank and sourcetype will show and count on the table. &lt;BR /&gt;
 Example:&lt;/P&gt;

&lt;P&gt;HOST     SOURCETYPE    PERCENT    DIFFERENCE   CURRENT   PREVIOUS&lt;BR /&gt;
x                                              100                      0                     1                 1&lt;BR /&gt;
Y                                              100                      0                     1                 1&lt;BR /&gt;
Z                                              100                      0                    1                 1&lt;/P&gt;

&lt;P&gt;Should be something like this:&lt;/P&gt;

&lt;P&gt;HOST     SOURCETYPE    PERCENT    DIFFERENCE   CURRENT   PREVIOUS&lt;BR /&gt;
x                           A                   100                      0                     1                 1&lt;BR /&gt;
Y                           B                   100                      0                     1                 1&lt;BR /&gt;
Z                           A                   100                      0                    1                 1&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 04:11:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407030#M117584</guid>
      <dc:creator>catherineang</dc:creator>
      <dc:date>2018-10-04T04:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get event count from current hour and previous hour by sourcetype and server/host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407031#M117585</link>
      <description>&lt;P&gt;@catherineang&lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=x sourcetype=* host=* earliest=-2h@h latest=now 
| eval period=if(_time&amp;gt;=relative_time(now(),"-1hr"),"current","previous") 
| eval temp=host.",".sourcetype
| chart count over temp by period 
| eval difference=current-previous 
| eval percent=(current/previous)*100 | eval host=mvindex(split(temp,","),0),sourcetype=mvindex(split(temp,","),0) 
| table sourcetype host percent difference current previous
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Oct 2018 14:16:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407031#M117585</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-10-04T14:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get event count from current hour and previous hour by sourcetype and server/host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407032#M117586</link>
      <description>&lt;P&gt;I updated the sourcetype index to 1 and it worked like a charm! Thank you @kamlesh_vaghela !&lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 02:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407032#M117586</guid>
      <dc:creator>catherineang</dc:creator>
      <dc:date>2018-10-09T02:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get event count from current hour and previous hour by sourcetype and server/host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407033#M117587</link>
      <description>&lt;P&gt;I updated the sourcetype index to 1 and it works like a charm! Thanks @kamlesh_vaghela ! &lt;/P&gt;</description>
      <pubDate>Tue, 09 Oct 2018 02:06:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407033#M117587</guid>
      <dc:creator>catherineang</dc:creator>
      <dc:date>2018-10-09T02:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get event count from current hour and previous hour by sourcetype and server/host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407034#M117588</link>
      <description>&lt;P&gt;@catherineang&lt;/P&gt;

&lt;P&gt;Glad to help you.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Happy Splunking&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 05:20:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/407034#M117588</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-02-11T05:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get event count from current hour and previous hour by sourcetype and server/host</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/507597#M141899</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jabezds_0-1594047311970.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9496iF20D11D89A4337E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jabezds_0-1594047311970.png" alt="jabezds_0-1594047311970.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to display the above details in splunk.. 33.5k is the total count of events(_raw).Here i am comparing the events from previous&amp;nbsp; 24 hour ,with the latest 24 hour.....with 1% being the average and inverted triangle can be + or - ve value obtained from the average.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can Someone help with this?&lt;/P&gt;&lt;P&gt;Thanks in Advance!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 15:01:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-event-count-from-current-hour-and-previous-hour-by/m-p/507597#M141899</guid>
      <dc:creator>jabezds</dc:creator>
      <dc:date>2020-07-06T15:01:58Z</dc:date>
    </item>
  </channel>
</rss>

