<?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 trigger an alert week day without data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598566#M208428</link>
    <description>&lt;P&gt;Read comments inline below for explanation of the search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;inindex=myIndex sourcetype=mySource Systems IN ("SYSTEM 1" , "SYSTEM 2" , "SYSTEM 3" , "SYSTEM 4")
| eval weekday="Wday-".strftime(_time,"%A")
| rename COMMENT as "Above will set the value as Wday-Mon instead of Mon.. and so forth for other days"
| eval EndHour=substr(time, 50, 1) 	
	| eval EndMin=substr(time, 52, 2)
	| eval time = EndHour.":".EndMin	
	| eval Time = " (" .EndHour. ":" .EndMin. "am)"
	| eval category="CATEGORY 1"
| chart values(Time) over Systems by weekday
| rename COMMENT as "After the chart command, you will see a column for each value of weekday i.e. Wday-Mon, Wday-Tue....etc)"
	| eval ExpectedTime = case(
				   System="SYSTEM 1", "6:30am",
				   System="SYSTEM 2", "6:35am",
				   System="SYSTEM 3", "6:45am",
				   System="SYSTEM 4", "6:40am"
			           )
	| eval CurrentSLO= case(
				   System="SYSTEM 1", "7:15am",
				   System="SYSTEM 2", "7:20am",
				   System="SYSTEM 3", "7:10am",
				   System="SYSTEM 4", "7:10am"
			        )			
| eval category="CATEGORY 1"
	| table category Systems ExpectedTime CurrentSLO Wday-*
	| rename ExpectedTime as "Expected Time" 
	| rename CurrentSLO as "Current SLO" 
	| rename category as "Category"
| eval hasMissingValues="false"
| rename COMMENT as "Now the foreach command will be run against each of week day fields that i.e. Wday-Mon, Wday-Tue..etc. It will than find out if there are missing values"
| foreach Wday-* [ | eval hasMissingValues=if(isnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'),"true",hasMissingValues)]
| where hasMissingValues="true"
| rename COMMEND as "Finally, renaming the Wday-Mon to just Mon..and so forth"
| rename Wday-* as *&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 19 May 2022 20:01:50 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2022-05-19T20:01:50Z</dc:date>
    <item>
      <title>How to trigger an alert week day without data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598173#M208298</link>
      <description>&lt;P&gt;Hi, I'm pretty new in splunk, I've been reading a lot of documentation and other questions here, but I don't find the help that I need.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="question.png" style="width: 824px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19679iC62F90275634C112/image-dimensions/824x140?v=v2" width="824" height="140" role="button" title="question.png" alt="question.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have this search, every day is a left join like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;index=myIndex sourcetype=mySource
	| eval weekday=strftime(_time,"%A")
	| where weekday = "Monday"
	| where Systems= "SYSTEM 1" OR "SYSTEM 2" OR "SYSTEM 3" OR "SYSTEM 4"

	| eval ExpectedTime = case(
				   System="SYSTEM 1", "6:30am",
				   System="SYSTEM 2", "6:35am",
				   System="SYSTEM 3", "6:45am",
				   System="SYSTEM 4", "6:40am"
			           )
	| eval CurrentSLO= case(
				   System="SYSTEM 1", "7:15am",
				   System="SYSTEM 2", "7:20am",
				   System="SYSTEM 3", "7:10am",
				   System="SYSTEM 4", "7:10am"
			        )			
	| eval EndHour=substr(time, 50, 1) 	
	| eval EndMin=substr(time, 52, 2)
	| eval time = EndHour.":".EndMin	
	| eval Mon = " (" .EndHour. ":" .EndMin. "am)"
	| eval category="CATEGORY 1"

	| table category Systems ExpectedTime CurrentSLO Mon Tue Wed Thu Fri  
	| rename ExpectedTime as "Expected Time" 
	| rename CurrentSLO as "Current SLO" 
	| rename category as "Category"
	
| join type=left Systems 
	[ search index=myIndex sourcetype=mySource 
		| eval weekday=strftime(_time,"%A")
		| where weekday = "Tusday"
		| where Systems= "SYSTEM 1" OR "SYSTEM 2" OR "SYSTEM 3" OR "SYSTEM 4"

		| eval ExpectedTime = case(
					   System="SYSTEM 1", "6:30am",
					   System="SYSTEM 2", "6:35am",
					   System="SYSTEM 3", "6:45am",
					   System="SYSTEM 4", "6:40am"
				           )
		| eval CurrentSLO= case(
					   System="SYSTEM 1", "7:15am",
					   System="SYSTEM 2", "7:20am",
					   System="SYSTEM 3", "7:10am",
					   System="SYSTEM 4", "7:10am"
				        )				
		| eval EndHour=substr(time, 50, 1) 	
		| eval EndMin=substr(time, 52, 2)
		| eval time = EndHour.":".EndMin	
		| eval Tue = " (" .EndHour. ":" .EndMin. "am)"
		| eval category="CATEGORY 1"

		| table category Systems ExpectedTime CurrentSLO Mon Tue Wed Thu Fri  
		| rename ExpectedTime as "Expected Time" 
		| rename CurrentSLO as "Current SLO" 
		| rename category as "Category"
		.
		.
		.&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I need to trigger an alert when there is no information for a day of the week.&lt;BR /&gt;&lt;BR /&gt;I've been trying whit search count=0, transaction and other failed solution attempts.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 20:07:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598173#M208298</guid>
      <dc:creator>Gzuluaga</dc:creator>
      <dc:date>2022-05-17T20:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger an alert Week day without data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598176#M208300</link>
      <description>&lt;P class=""&gt;I would first optimize your search like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myIndex sourcetype=mySource Systems IN ("SYSTEM 1" , "SYSTEM 2" , "SYSTEM 3" , "SYSTEM 4")
| eval weekday=strftime(_time,"%A")
| eval EndHour=substr(time, 50, 1) 	
	| eval EndMin=substr(time, 52, 2)
	| eval time = EndHour.":".EndMin	
	| eval Time = " (" .EndHour. ":" .EndMin. "am)"
	| eval category="CATEGORY 1"
| chart values(Time) over Systems by weekday
	| eval ExpectedTime = case(
				   System="SYSTEM 1", "6:30am",
				   System="SYSTEM 2", "6:35am",
				   System="SYSTEM 3", "6:45am",
				   System="SYSTEM 4", "6:40am"
			           )
	| eval CurrentSLO= case(
				   System="SYSTEM 1", "7:15am",
				   System="SYSTEM 2", "7:20am",
				   System="SYSTEM 3", "7:10am",
				   System="SYSTEM 4", "7:10am"
			        )			
| eval category="CATEGORY 1"
	| table category Systems ExpectedTime CurrentSLO Mon Tue Wed Thu Fri  
	| rename ExpectedTime as "Expected Time" 
	| rename CurrentSLO as "Current SLO" 
	| rename category as "Category"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To generate alert on missing column value, just add following to above search:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval hasMissingValues="false"
| foreach Mon Tue Wed Thu Fri [ | eval hasMissingValues=if(isnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'),"true",hasMissingValues)]
| where hasMissingValues="true"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 19:53:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598176#M208300</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-05-17T19:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger an alert Week day without data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598510#M208409</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;for your help!&lt;/P&gt;&lt;P&gt;Optimize the search as you taught me and added the lines to generate a missing column value, but it is always true even when there is data.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gzuluaga_0-1652969640362.png" style="width: 769px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19717i4FC94CC2561E74D3/image-dimensions/769x114?v=v2" width="769" height="114" role="button" title="Gzuluaga_0-1652969640362.png" alt="Gzuluaga_0-1652969640362.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;it's supposed would be false, right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because I'm thinking to use the field&amp;nbsp;&lt;STRONG&gt;hasMissingValues="true"&lt;/STRONG&gt; to trigger my alert.&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 15:19:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598510#M208409</guid>
      <dc:creator>Gzuluaga</dc:creator>
      <dc:date>2022-05-19T15:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger an alert Week day without data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598513#M208411</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm realize if I remove &lt;STRONG&gt;Fri&lt;/STRONG&gt; in the foreach (today is thursday) it works!&lt;/P&gt;&lt;P&gt;Now I'm thinking in a way to do the same dynamically, for example if today is &lt;STRONG&gt;Tuesday&lt;/STRONG&gt; the foreach must only eval &lt;STRONG&gt;Monday&lt;/STRONG&gt; and &lt;STRONG&gt;Tuesday&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gzuluaga_0-1652970113724.png" style="width: 956px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19718iE2454279C026075D/image-dimensions/956x318?v=v2" width="956" height="318" role="button" title="Gzuluaga_0-1652970113724.png" alt="Gzuluaga_0-1652970113724.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 14:35:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598513#M208411</guid>
      <dc:creator>Gzuluaga</dc:creator>
      <dc:date>2022-05-19T14:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger an alert Week day without data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598546#M208422</link>
      <description>&lt;P class="lia-align-left"&gt;I forgot about days which have not come yet. So try this version (no hard coded week days)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;inindex=myIndex sourcetype=mySource Systems IN ("SYSTEM 1" , "SYSTEM 2" , "SYSTEM 3" , "SYSTEM 4")
| eval weekday="Wday-".strftime(_time,"%A")
| eval EndHour=substr(time, 50, 1) 	
	| eval EndMin=substr(time, 52, 2)
	| eval time = EndHour.":".EndMin	
	| eval Time = " (" .EndHour. ":" .EndMin. "am)"
	| eval category="CATEGORY 1"
| chart values(Time) over Systems by weekday
	| eval ExpectedTime = case(
				   System="SYSTEM 1", "6:30am",
				   System="SYSTEM 2", "6:35am",
				   System="SYSTEM 3", "6:45am",
				   System="SYSTEM 4", "6:40am"
			           )
	| eval CurrentSLO= case(
				   System="SYSTEM 1", "7:15am",
				   System="SYSTEM 2", "7:20am",
				   System="SYSTEM 3", "7:10am",
				   System="SYSTEM 4", "7:10am"
			        )			
| eval category="CATEGORY 1"
	| table category Systems ExpectedTime CurrentSLO Wday-*
	| rename ExpectedTime as "Expected Time" 
	| rename CurrentSLO as "Current SLO" 
	| rename category as "Category"
| eval hasMissingValues="false"
| foreach Wday-* [ | eval hasMissingValues=if(isnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'),"true",hasMissingValues)]
| where hasMissingValues="true"
| rename Wday-* as *&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 May 2022 17:57:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598546#M208422</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-05-19T17:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trigger an alert Week day without data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598558#M208426</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp; but I don't understand your search, I mean, there is a&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval weekday="Wday-".strftime(_time,"%A")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But then you are using the string "Wday-" to filter, but &lt;STRONG&gt;Wday&lt;/STRONG&gt; is not a field in the search.&lt;BR /&gt;&lt;BR /&gt;In my main search have &lt;STRONG&gt;Mon Tue Wed Thu Fri&lt;/STRONG&gt;, those are calculated fields and indicate if there is data or not.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| table category Systems ExpectedTime CurrentSLO Mon Tue Wed Thu Fri&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand your idea to filter, I'm trying to do that with every day (calculated fields)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 19:30:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598558#M208426</guid>
      <dc:creator>Gzuluaga</dc:creator>
      <dc:date>2022-05-19T19:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an alert week day without data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598566#M208428</link>
      <description>&lt;P&gt;Read comments inline below for explanation of the search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;inindex=myIndex sourcetype=mySource Systems IN ("SYSTEM 1" , "SYSTEM 2" , "SYSTEM 3" , "SYSTEM 4")
| eval weekday="Wday-".strftime(_time,"%A")
| rename COMMENT as "Above will set the value as Wday-Mon instead of Mon.. and so forth for other days"
| eval EndHour=substr(time, 50, 1) 	
	| eval EndMin=substr(time, 52, 2)
	| eval time = EndHour.":".EndMin	
	| eval Time = " (" .EndHour. ":" .EndMin. "am)"
	| eval category="CATEGORY 1"
| chart values(Time) over Systems by weekday
| rename COMMENT as "After the chart command, you will see a column for each value of weekday i.e. Wday-Mon, Wday-Tue....etc)"
	| eval ExpectedTime = case(
				   System="SYSTEM 1", "6:30am",
				   System="SYSTEM 2", "6:35am",
				   System="SYSTEM 3", "6:45am",
				   System="SYSTEM 4", "6:40am"
			           )
	| eval CurrentSLO= case(
				   System="SYSTEM 1", "7:15am",
				   System="SYSTEM 2", "7:20am",
				   System="SYSTEM 3", "7:10am",
				   System="SYSTEM 4", "7:10am"
			        )			
| eval category="CATEGORY 1"
	| table category Systems ExpectedTime CurrentSLO Wday-*
	| rename ExpectedTime as "Expected Time" 
	| rename CurrentSLO as "Current SLO" 
	| rename category as "Category"
| eval hasMissingValues="false"
| rename COMMENT as "Now the foreach command will be run against each of week day fields that i.e. Wday-Mon, Wday-Tue..etc. It will than find out if there are missing values"
| foreach Wday-* [ | eval hasMissingValues=if(isnull('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'),"true",hasMissingValues)]
| where hasMissingValues="true"
| rename COMMEND as "Finally, renaming the Wday-Mon to just Mon..and so forth"
| rename Wday-* as *&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 19 May 2022 20:01:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598566#M208428</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-05-19T20:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to trigger an alert week day without data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598706#M208475</link>
      <description>&lt;P&gt;Thanks a lot!&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/15147"&gt;@somesoni2&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works!&lt;BR /&gt;&lt;BR /&gt;It was very helpful and I learned a lot.&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2022 18:30:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-trigger-an-alert-week-day-without-data/m-p/598706#M208475</guid>
      <dc:creator>Gzuluaga</dc:creator>
      <dc:date>2022-05-20T18:30:54Z</dc:date>
    </item>
  </channel>
</rss>

