<?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 use mstats and inputlookup command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659855#M227804</link>
    <description>&lt;P&gt;Matching hour of day is exactly why you cannot use inputlookup subsearch. &amp;nbsp;But now you want 9 - 5:30 instead of 9 - 5, this means that we need to consider %M as well.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats some filters
| &amp;lt;some more sophisticated filters&amp;gt;
| eval Date = split(strftime(_time, "%m/%d/%Y:%H%M"), ":")
| eval tod = mvindex(Date, 1), Date = mvindex(Date, 0)
| lookup mylookup Date
| where NOT (Description == "Bank holiday" AND tod &amp;gt; 900 AND tod &amp;lt; 1730)&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 05 Oct 2023 19:45:43 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-10-05T19:45:43Z</dc:date>
    <item>
      <title>How to use mstats and inputlookup command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659830#M227797</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a alert query that uses mstats, I want this query to not throw alert during public holidays (from 9 AM to 5 PM). I have created a lookup holidays.csv with columns "Date","Description". How can i use this lookup with the already mstats command to check for the date and time in the lookup file and if its in the timerange in the file then not trigger the alert or probably not search. Thanks in advance.&lt;/P&gt;&lt;P&gt;Lookup file:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abhi04_0-1696527434097.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27461iC0913356DB2310DB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abhi04_0-1696527434097.png" alt="abhi04_0-1696527434097.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 17:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659830#M227797</guid>
      <dc:creator>abhi04</dc:creator>
      <dc:date>2023-10-05T17:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use mstats and inputlookup command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659834#M227799</link>
      <description>&lt;P&gt;As you said "I" (you) have created the lookup table, my advice is to enter Date as epoch time if possible. (Splunk itself can help with that using commands like outputlookup.) &amp;nbsp;If you must use a human readable format such as "%m/%d/%Y" as your screenshot suggests, you need to convert your event _time to that same format. &amp;nbsp;Something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats some filters
| &amp;lt;some more sophisticated filters&amp;gt;
| eval Date = split(strftime(_time, "%m/%d/%Y:%H"), ":")
| eval hour = mvindex(Date, 1), Date = mvindex(Date, 0)
| lookup mylookup Date
| where NOT (Description == "Bank holiday" AND hour &amp;gt; 8 AND hour &amp;lt; 18)&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 17:53:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659834#M227799</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-05T17:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use mstats and inputlookup command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659847#M227801</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;Thanks for the query, just wanted to update that I was able to get the results that are not in the holiday date but got stuck on how to also put a filter on the hour (9 Am - 5:30 PM on holiday)&lt;/P&gt;&lt;P&gt;The query I used to exclude events on holiday&lt;/P&gt;&lt;P&gt;| search NOT&lt;BR /&gt;[| inputlookup holidays.csv&lt;BR /&gt;| rename HolidayDate as Date&lt;BR /&gt;| fields Date ]&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 19:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659847#M227801</guid>
      <dc:creator>abhi04</dc:creator>
      <dc:date>2023-10-05T19:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use mstats and inputlookup command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659855#M227804</link>
      <description>&lt;P&gt;Matching hour of day is exactly why you cannot use inputlookup subsearch. &amp;nbsp;But now you want 9 - 5:30 instead of 9 - 5, this means that we need to consider %M as well.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats some filters
| &amp;lt;some more sophisticated filters&amp;gt;
| eval Date = split(strftime(_time, "%m/%d/%Y:%H%M"), ":")
| eval tod = mvindex(Date, 1), Date = mvindex(Date, 0)
| lookup mylookup Date
| where NOT (Description == "Bank holiday" AND tod &amp;gt; 900 AND tod &amp;lt; 1730)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 Oct 2023 19:45:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-mstats-and-inputlookup-command/m-p/659855#M227804</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-05T19:45:43Z</dc:date>
    </item>
  </channel>
</rss>

