<?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: custom query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680082#M232477</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;check the hours of these events, if they match the condition of your search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2024 15:45:16 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2024-03-08T15:45:16Z</dc:date>
    <item>
      <title>custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679877#M232411</link>
      <description>&lt;LI-CODE lang="markup"&gt;|tstats count where index=app-idx host="*abfd*" sourcetype=app-source-logs by host&lt;/LI-CODE&gt;&lt;P&gt;This is my alert query, i want to modify the query so that i wont receive alert at certain times.&lt;BR /&gt;For example: Every month like on 10 , 18, 25 and during 8am to 11am i don't want to get the alerts.&lt;BR /&gt;Rest all for other days its should work as normal.&lt;BR /&gt;&lt;BR /&gt;how can i do it???&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 21:02:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679877#M232411</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-06T21:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679884#M232415</link>
      <description>&lt;P&gt;Something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|tstats count max(_time) as _time ``` you will need latest _time ```
  where index=app-idx host="*abfd*" sourcetype=app-source-logs by host
| eval dom = strftime(_time, "%m"), hod = strftime(_time, "%H")
| where NOT dom IN (10, 18, 25) AND (8 &amp;gt; hod OR hod &amp;gt; 11) ``` whether AND or OR depends on exact semantic ```
| fields - _time dom hod&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Several points of discussion.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Semantics of "&lt;SPAN&gt;on 10 , 18, 25 and during 8am to 11am" is very loose in English. &amp;nbsp;Two opposite interpretations can be conveyed by this same phrase. &amp;nbsp;So you need to tune the logic according to your intention.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;_time is taken as the latest in dataset by host. &amp;nbsp;Depending on your data density, you may want to take some other approach, such as info_endtime.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;It is probably better to code your exclusions in a CSV than hard code in search. &amp;nbsp;But that's out of the scope of this question.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 07 Mar 2024 03:15:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679884#M232415</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-03-07T03:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679888#M232419</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;, thank you for the inputs.&lt;/P&gt;&lt;P&gt;As we have more number of alerts to be done. We want to go with CSV option.&lt;/P&gt;&lt;P&gt;I will create CSV file and will add time,&amp;nbsp; date and month, but I am not sure how to link with that in query&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me on that&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 23:42:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679888#M232419</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-06T23:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679904#M232426</link>
      <description>&lt;P&gt;Assuming you make a lookup called silence.csv with the following:&lt;/P&gt;&lt;TABLE border="1" width="53.52154356060606%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="18.93939393939394%"&gt;exclude_days&lt;/TD&gt;&lt;TD width="20.833333333333343%"&gt;silence_start&lt;/TD&gt;&lt;TD width="13.750238231370304%"&gt;silence_end&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="18.93939393939394%"&gt;10,18,25&lt;/TD&gt;&lt;TD width="20.833333333333343%"&gt;8&lt;/TD&gt;&lt;TD width="13.750238231370304%"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;you can do something liie&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count max(_time) as _time ``` you will need latest _time ```
  where index=app-idx host="*abfd*" sourcetype=app-source-logs by host
| eval dom = strftime(_time, "%m"), hod = strftime(_time, "%H")
| append
    [inputlookup exclusions.csv
    | eval exclude_days = split(exclude_days, ",")]
| eventstats values(exclude_days) as exclude_days values(silence_*) as silent_*
| where NOT dom IN exclude_days AND (silence_start &amp;gt; hod OR hod &amp;gt; silence_end) ``` whether AND or OR depends on exact semantic ```
| fields - _time dom hod&lt;/LI-CODE&gt;&lt;P&gt;But note if you have lots of hosts with alert, this can get slow. &amp;nbsp;This is a method that is flexible to implement either of possible intentions in a similar fashion. &amp;nbsp;If performance becomes a problem, you will need optimize for the exact intent.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 04:55:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679904#M232426</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-03-07T04:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679910#M232427</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;you have to exclude from results the days and the hours, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
| eval 
   day=strftime(_time, "%d"), 
   hour=strftime(_time, "%H")
| where NOT (day IN (10, 18, 25) OR hour&amp;lt;8 OR hour&amp;gt;11)
| fields - _time day hour&lt;/LI-CODE&gt;&lt;P&gt;You can also check weekends and holydays, using using a lookup containing the holydays, e.g.:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;date type
2024-03-29 ferial
2024-03-30 weekend
2024-04-31 weekend
2024-04-01 holyday
2024-04-02 ferial
2024-04-03 ferial
2024-04-04 ferial
2024-04-05 weekend
2024-04-06 weekend
2024-04-07 ferial&lt;/LI-CODE&gt;&lt;P&gt;and running something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
| eval 
   day=strftime(_time, "%d"), 
   hour=strftime(_time, "%H"),
   date=strftime(_time, "%Y-%m-%d
|lookup calendsr.csv date OUTPUT type
| where NOT (day IN (10, 18, 25) OR hour&amp;lt;8 OR hour&amp;gt;11 OR type IN ("weekend", "holyday"))
| fields - _time day hour&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 07:08:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/679910#M232427</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-07T07:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680065#M232473</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;, Thank you so much, you gave me exactly what i want. but i tried but i don't want to add any date or hours in the query i added&amp;nbsp; them in the csv file and run the below query still i am receiving the alerts.&lt;BR /&gt;can you please let me know what i am missing.&lt;BR /&gt;&lt;BR /&gt;And i want to add time also in the csv file, and link to the query so that during mentioned time and date my alert should not trigger.&lt;BR /&gt;please help me on that&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
|appendcols
[|makeresults
   |eval Today=date=strftime(_time, "%m/%d/%Y")
|lookup calendsr.csv date OUTPUT type
|eval type=if(isnotnull)(type),type,"NotHoliday"]&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 14:47:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680065#M232473</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-08T14:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680068#M232474</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;your search isn't correct, there are some syntax errors.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
| appendcols [ | makeresults
   | eval date=strftime(_time, "%m/%d/%Y")
   | lookup calendsr.csv date OUTPUT type
   | eval type=if(isnotnull(type),type,"NotHoliday"]&lt;/LI-CODE&gt;&lt;P&gt;Anyway, not using the hours ,&amp;nbsp;you check only a part of the requirementas you described.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 14:57:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680068#M232474</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-08T14:57:55Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680079#M232476</link>
      <description>&lt;P&gt;i tried the query u provided i am receiving the alerts.&lt;BR /&gt;not sure what i am missing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 15:43:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680079#M232476</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-08T15:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680082#M232477</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;check the hours of these events, if they match the condition of your search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 15:45:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680082#M232477</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-08T15:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680083#M232478</link>
      <description>&lt;P&gt;yes events are present, my alert condition is results greater than zeros for last 15 minutes. but as per my requirement i mentioned todays date in the csv file,&amp;nbsp; so alert should not trigger right&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 15:48:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680083#M232478</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-08T15:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680085#M232479</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;the condition you required is that hour must be NOT hour&amp;lt;8 OR hour&amp;gt;11.&lt;/P&gt;&lt;P&gt;Are the hours of the events in the results compliant with this condition?&lt;/P&gt;&lt;P&gt;maybe you should change the hour condition.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 15:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680085#M232479</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-08T15:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680095#M232481</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;, my goal is to i don't want to receive the alerts&amp;nbsp; during certain days. For example in csv file i gave todays date.&amp;nbsp; My alert condition is count &amp;gt;0, corn job is 15mins&amp;nbsp; for last 15 minutes. time range.&lt;BR /&gt;&lt;BR /&gt;Used below query still i am receiving alerts.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
|where count &amp;gt;0
| appendcols [ | makeresults
   | eval date=strftime(_time, "%m/%d/%Y")
   | lookup calendsr.csv date OUTPUT type
   | eval type=if(isnotnull(type),type,"NotHoliday"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 16:19:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680095#M232481</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-08T16:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680100#M232482</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;instead of appendcols thet run as it prefer, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs NOT [ | inputlookup calendsr.csv WHERE type="holyday" | fields date ]
   BY host&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 16:56:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680100#M232482</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-08T16:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680106#M232484</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;, i tried the query, still&amp;nbsp; i am getting alerts&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 17:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680106#M232484</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-08T17:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680122#M232488</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;sorry there was an error:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
| eval date=strftime(_time,"%Y-%m-%d")
| search NOT [ | inputlookup calendsr.csv WHERE type="holyday" | fields date ]&lt;/LI-CODE&gt;&lt;P&gt;in in the lookup calendar.csv you have&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;date   type
2024-03-08 normal
2024-03-09 holyday
2024-03-10 holyday&lt;/LI-CODE&gt;&lt;P&gt;the alert will not trigger in the 2024-03-09.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2024 21:14:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680122#M232488</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-08T21:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680224#M232510</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;, Thank you so much the query you provided worked.&lt;BR /&gt;But when&amp;nbsp; i am trying to add time its not working, please find the below query:&lt;BR /&gt;Can you please help on this???&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
| eval date=strftime(_time,"%Y-%m-%d %H:%M")
| search NOT [ | inputlookup calendsr.csv WHERE type="holyday" | fields date ]&lt;/LI-CODE&gt;&lt;P&gt;csv file as below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;date   type
2024-03-08 12:00 normal
2024-03-09 10:00 holyday
2024-03-09 12:00 holyday
2024-03-09 18:00 holyday
2024-03-09 23:00 holyday
2024-03-10 14:00 holyday
2024-03-10 18:00 holyday
2024-03-10 22:00 holyday&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 00:55:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680224#M232510</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-11T00:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680245#M232517</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;it's clear, in your event's you haven't the starting hours (12:00).&lt;/P&gt;&lt;P&gt;As I described in my first answer, you have to manage hours in a different way (outside the lookup):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats 
   count 
   latest(_time) as _time
   WHERE index=app-idx host="*abfd*" sourcetype=app-source-logs 
   BY host
| eval 
   date=strftime(_time,"%Y-%m-%d"),
   day=strftime(_time, "%d"), 
   hour=strftime(_time, "%H")
| search NOT (hour&amp;lt;8 OR hour&amp;gt;11 OR [ | inputlookup calendsr.csv WHERE type="holyday" | fields date ] )
| fields - _time day hour&lt;/LI-CODE&gt;&lt;P&gt;obviously, using the date in the lookup without hours and minutes.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 07:54:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680245#M232517</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-11T07:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680270#M232520</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;, is there is a way where I can update the hours in csv file not in the query.&lt;/P&gt;&lt;P&gt;can we do that ???&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 11:28:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680270#M232520</guid>
      <dc:creator>Harish2</dc:creator>
      <dc:date>2024-03-11T11:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: custom query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680280#M232523</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252469"&gt;@Harish2&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;no it's the easiest and flexible way, but why you don't want to use the hours and minutes in the search?&lt;/P&gt;&lt;P&gt;you can also create a macro to call instead adding all the conditions to your searches.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 13:51:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/custom-query/m-p/680280#M232523</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-03-11T13:51:04Z</dc:date>
    </item>
  </channel>
</rss>

