<?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 total count of events excluding specific time range for certain days? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-count-of-events-excluding-specific-time-range/m-p/481574#M134967</link>
    <description>&lt;P&gt;Can you please try this in place of your "where" expression?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where NOT (date_wday="monday" AND date_hour&amp;gt;=16 AND date_hour&amp;lt;18) AND NOT (date_wday="wednesday" AND date_hour&amp;gt;=18 AND date_hour&amp;lt;20)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And why do you have "by events" at the end?&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2019 17:25:31 GMT</pubDate>
    <dc:creator>jpolvino</dc:creator>
    <dc:date>2019-09-16T17:25:31Z</dc:date>
    <item>
      <title>How to get total count of events excluding specific time range for certain days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-count-of-events-excluding-specific-time-range/m-p/481573#M134966</link>
      <description>&lt;P&gt;Can anyone please help?&lt;/P&gt;

&lt;P&gt;I want to display the total count of events occurred in a week (but excluding specific day/time i.e. exclude 04-06 PM for Monday and 06-08 PM for Wednesday)&lt;/P&gt;

&lt;P&gt;I am running below search, but it doesn't seem to be excluding the counts for specific time because if I am trying to remove the excluding condition, I am still getting the same results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=web_server events IN ("GET", "Delete")
 | eval myHour=strftime(_time, "%H") 
 | eval myMinute=strftime(_time, "%M") 
 | eval day_of_week = strftime(_time,"%A")
  | where NOT ( (day_of_week = "Monday" AND myHour= 4 AND myMinute&amp;gt;=0) OR (day_of_week = "Monday" AND myHour=5) OR (day_of_week = "Monday" AND myHour=6 AND myMinute&amp;lt;=59) OR (day_of_week = "Wednesday" AND myHour= 6 AND myMinute&amp;gt;=0) OR (day_of_week = "Wednesday" AND myHour=7) OR (day_of_week = "Wednesday" AND myHour=8 AND myMinute&amp;lt;=59))
  | stats count as Total_events avg(duration) as Duration_of_events by events
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Sep 2019 16:25:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-count-of-events-excluding-specific-time-range/m-p/481573#M134966</guid>
      <dc:creator>sahil237888</dc:creator>
      <dc:date>2019-09-16T16:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get total count of events excluding specific time range for certain days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-count-of-events-excluding-specific-time-range/m-p/481574#M134967</link>
      <description>&lt;P&gt;Can you please try this in place of your "where" expression?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where NOT (date_wday="monday" AND date_hour&amp;gt;=16 AND date_hour&amp;lt;18) AND NOT (date_wday="wednesday" AND date_hour&amp;gt;=18 AND date_hour&amp;lt;20)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And why do you have "by events" at the end?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 17:25:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-count-of-events-excluding-specific-time-range/m-p/481574#M134967</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-09-16T17:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get total count of events excluding specific time range for certain days?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-count-of-events-excluding-specific-time-range/m-p/481575#M134968</link>
      <description>&lt;P&gt;try this and see if it works for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;YOUR_INDEX_HERE&amp;gt; sourcetype=web_server events IN ("GET", "Delete")
| eval myHour=strftime(_time, "%H") 
| eval myMinute=strftime(_time, "%M") 
| eval day_of_week = strftime(_time,"%A")
| eval i_care_about_it = if((day_of_week="Monday" AND myHour=4 AND myMinute&amp;gt;=0) OR (day_of_week="Monday" AND myHour=5) OR (day_of_week="Monday" AND myHour=6 AND myMinute&amp;lt;=59) OR (day_of_week="Wednesday" AND myHour=6 AND myMinute&amp;gt;=0) OR (day_of_week="Wednesday" AND myHour=7) OR (day_of_week="Wednesday" AND myHour=8 AND myMinute&amp;lt;=59),"false","true")
| stats count by i_care_about_it day_of_week myHour myMinute
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope it helps&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 17:46:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-count-of-events-excluding-specific-time-range/m-p/481575#M134968</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2019-09-16T17:46:17Z</dc:date>
    </item>
  </channel>
</rss>

