<?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 Splunk query/condition to check and trigger Alert 2 hours before the Job Completion time? in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-query-condition-to-check-and-trigger-Alert-2-hours-before/m-p/613026#M9010</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;My Job completes at 4AM,I need to set up a alert to monitor the job status 2 hours before the job completion time i.e. at 2 AM i should start checking the Job Status if it completed or not,So starting from 2AM i should monitor and trigger the alert till the job is completed.&lt;/P&gt;
&lt;P&gt;I am using below query but it doesn't make sense and doesn't satisfies&amp;nbsp; my above condition.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| makeresults
| eval CurrentTime="05:00:00"
| eval CurrentTimepoch=strptime(CurrentTime,"%H:%M:%S")
| eval SLATIME="04:00:00"
| eval SLATIMEepoch=strptime(SLATIME,"%H:%M:%S")
| eval Diff=(SLATIMEepoch-CurrentTimepoch)
| eval Duration=if(Diff&amp;lt;0, "-", "") + tostring(abs(Diff), "duration")
| eval check1=case(Duration&amp;gt;="02:00:00" AND STATUS!=C,"Trigger",1=1,"Dont")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Please help me how to capture specific time i.e. 2 AM and start checking the job status in the query?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Sep 2022 16:37:28 GMT</pubDate>
    <dc:creator>Ashwini008</dc:creator>
    <dc:date>2022-09-14T16:37:28Z</dc:date>
    <item>
      <title>Splunk query/condition to check and trigger Alert 2 hours before the Job Completion time?</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-query-condition-to-check-and-trigger-Alert-2-hours-before/m-p/613026#M9010</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;My Job completes at 4AM,I need to set up a alert to monitor the job status 2 hours before the job completion time i.e. at 2 AM i should start checking the Job Status if it completed or not,So starting from 2AM i should monitor and trigger the alert till the job is completed.&lt;/P&gt;
&lt;P&gt;I am using below query but it doesn't make sense and doesn't satisfies&amp;nbsp; my above condition.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| makeresults
| eval CurrentTime="05:00:00"
| eval CurrentTimepoch=strptime(CurrentTime,"%H:%M:%S")
| eval SLATIME="04:00:00"
| eval SLATIMEepoch=strptime(SLATIME,"%H:%M:%S")
| eval Diff=(SLATIMEepoch-CurrentTimepoch)
| eval Duration=if(Diff&amp;lt;0, "-", "") + tostring(abs(Diff), "duration")
| eval check1=case(Duration&amp;gt;="02:00:00" AND STATUS!=C,"Trigger",1=1,"Dont")&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Please help me how to capture specific time i.e. 2 AM and start checking the job status in the query?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 16:37:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Splunk-query-condition-to-check-and-trigger-Alert-2-hours-before/m-p/613026#M9010</guid>
      <dc:creator>Ashwini008</dc:creator>
      <dc:date>2022-09-14T16:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk query/condition to check and trigger Alert 2 hours before the Job Completion time</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-query-condition-to-check-and-trigger-Alert-2-hours-before/m-p/613042#M9011</link>
      <description>&lt;P&gt;You have provided a very little information on your environment, but If I understand your problem correctly, the following should allow you to determine if current time is later than the checking trigger time (2AM)&lt;BR /&gt;&lt;BR /&gt;| makeresults&lt;BR /&gt;| eval triggerTime = relative_time(now(), "@d") + (2*3600)&lt;BR /&gt;| eval check = if(now() &amp;gt; triggerTime, "Trigger", "Don't")&lt;/P&gt;&lt;P&gt;The relative_time function is used to round epoch time down to the beginning of the day and then the number of seconds 2 hours have (2*3600) is added.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 09:37:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Splunk-query-condition-to-check-and-trigger-Alert-2-hours-before/m-p/613042#M9011</guid>
      <dc:creator>JacekF</dc:creator>
      <dc:date>2022-09-14T09:37:26Z</dc:date>
    </item>
  </channel>
</rss>

