<?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 duration between a start and stop event and trigger an alert if duration is greater than 5 minutes? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329931#M5856</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3479i6CD22AB4BA5EA787/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;i've attached a screenshot and i hope that helps.the blue highlighted part is what i am looking for.as you can see from the data, the service in question stops and starts in seconds,but when it doesn't ,all hell brakes loose.so if possible i want to be alerted thru splunk when that happens.as the pattern shows from the log that service recovers fairly quick and if not, like the one below i wanna pull that information from the log file which is windows application event log.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2017 00:49:35 GMT</pubDate>
    <dc:creator>carlyleadmin</dc:creator>
    <dc:date>2017-09-12T00:49:35Z</dc:date>
    <item>
      <title>How to get duration between a start and stop event and trigger an alert if duration is greater than 5 minutes?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329926#M5851</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
 i am new to the splunk and i do have a search which returns a service stopped from windows application event log.from the results i can see when the service does not start automatically(usually if there is a gap greater than 1-2 mins between start and stop).service stops and in less than  20 secs it starts back again.&lt;/P&gt;

&lt;P&gt;here is my search&lt;/P&gt;

&lt;P&gt;sourcetype="WMI:WinEventLog:Application" SourceName="Word Processing Service" Message="*"&lt;/P&gt;

&lt;P&gt;and here are the results;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;9/7/17
11:08:15.000 AM 
20170907110815.000000
Category=0
CategoryString=NULL
EventCode=0
EventIdentifier=0
EventType=3
Logfile=Application
RecordNumber=264012
SourceName=Word Processing Service
TimeGenerated=20170907150815.000000-000
TimeWritten=20170907150815.000000-000
Type=Information
User=NULL
ComputerName=x
wmi_type=WinEventLog:Application
Message=Service stopped successfully.

9/7/17
11:08:20.000 AM 
20170907110820.000000
Category=0
CategoryString=NULL
EventCode=0
EventIdentifier=0
EventType=3
Logfile=Application
RecordNumber=264016
SourceName=Word Processing Service
TimeGenerated=20170907150820.000000-000
TimeWritten=20170907150820.000000-000
Type=Information
User=NULL
ComputerName=x
wmi_type=WinEventLog:Application
Message=Service started successfully.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in reality i want to create an alert and when that gap happens and service does  not start back in lets say, in 2 mins send an email out.i did find another post about this but not quite the same,or maybe it is the same but like i said i am new to this and was not able to apply it to my case.here is the link for that post&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/524252/how-to-get-duration-between-a-start-and-stop-event.html"&gt;https://answers.splunk.com/answers/524252/how-to-get-duration-between-a-start-and-stop-event.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Any help you can provide is greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 20:17:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329926#M5851</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-11T20:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duration between a start and stop event and trigger an alert if duration is greater than 5 minutes?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329927#M5852</link>
      <description>&lt;P&gt;Which of the timestamps do you want to use? I see three in the events, and there &lt;STRONG&gt;could&lt;/STRONG&gt; be a fourth if &lt;CODE&gt;_time&lt;/CODE&gt; doesn't come from one of those.&lt;/P&gt;

&lt;P&gt;Do you have a way to correlate the two events (like with the &lt;CODE&gt;transaction&lt;/CODE&gt; command)? Or are you potentially having windows that will span days or months?&lt;/P&gt;

&lt;P&gt;Are you just interested in the last two events?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 21:47:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329927#M5852</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-09-11T21:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duration between a start and stop event and trigger an alert if duration is greater than 5 minutes?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329928#M5853</link>
      <description>&lt;P&gt;Assuming that there are ONLY 2 types of &lt;CODE&gt;Message&lt;/CODE&gt; values, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YouShouldAlwaysSpecifyAnIndex sourcetype="WMI:WinEventLog:Application" SourceName="Word Processing Service" Message="*"
| streamstats count(eval(Message="Service stopped successfully.")) AS sessionID BY host
| stats range(_time) AS downTimeSeconds count AS messages values(Message) AS Messages
| eval now=now()
| eval downTimeSeconds = if((messages=1), now - _time, downTimeSeconds)
| where downTimeSeconds &amp;gt; 2*60
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Sep 2017 21:49:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329928#M5853</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-09-11T21:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duration between a start and stop event and trigger an alert if duration is greater than 5 minutes?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329929#M5854</link>
      <description>&lt;P&gt;yeah, not sure if this is going to work.for the sourcetype"word processing service" i get 2 messages,1 "service stopped successfully" and 2 "service started successfully".and when the service stops it causes bunch of errors so i need to tell splunk  when there is a minute gap between services(stopped and not started)i need an alert set an send me an email if possible.&lt;/P&gt;

&lt;P&gt;or better yet,from that search if only i can bring the results where there is a big gap between stop and start services for "word processing service".i guess when i initially created my post i over complicated the process.i hope this make sense,if not ,i'd appreciate you guys taking the time to respond.&lt;/P&gt;

&lt;P&gt;this is where the service stopped on 6th;&lt;/P&gt;

&lt;P&gt;9/6/17&lt;BR /&gt;
5:42:20.000 PM&lt;BR /&gt;&lt;BR /&gt;
20170906174220.000000&lt;BR /&gt;
Category=0&lt;BR /&gt;
CategoryString=NULL&lt;BR /&gt;
EventCode=0&lt;BR /&gt;
EventIdentifier=0&lt;BR /&gt;
EventType=3&lt;BR /&gt;
Logfile=Application&lt;BR /&gt;
RecordNumber=263910&lt;BR /&gt;
SourceName=Word Processing Service&lt;BR /&gt;
TimeGenerated=20170906214220.000000-000&lt;BR /&gt;
TimeWritten=20170906214220.000000-000&lt;BR /&gt;
Type=Information&lt;BR /&gt;
User=NULL&lt;BR /&gt;
ComputerName=x&lt;BR /&gt;
wmi_type=WinEventLog:Application&lt;BR /&gt;
Message=Service stopped successfully.&lt;/P&gt;

&lt;P&gt;and this is where the service started back up the next day;&lt;/P&gt;

&lt;P&gt;9/7/17&lt;BR /&gt;
11:05:56.000 AM &lt;BR /&gt;
20170907110556.000000&lt;BR /&gt;
Category=0&lt;BR /&gt;
CategoryString=NULL&lt;BR /&gt;
EventCode=0&lt;BR /&gt;
EventIdentifier=0&lt;BR /&gt;
EventType=3&lt;BR /&gt;
Logfile=Application&lt;BR /&gt;
RecordNumber=263954&lt;BR /&gt;
SourceName=Word Processing Service&lt;BR /&gt;
TimeGenerated=20170907150556.000000-000&lt;BR /&gt;
TimeWritten=20170907150556.000000-000&lt;BR /&gt;
Type=Information&lt;BR /&gt;
User=NULL&lt;BR /&gt;
ComputerName=x&lt;BR /&gt;
wmi_type=WinEventLog:Application&lt;BR /&gt;
Message=Service started successfully.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2017 23:41:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329929#M5854</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-11T23:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duration between a start and stop event and trigger an alert if duration is greater than 5 minutes?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329930#M5855</link>
      <description>&lt;P&gt;I am totally lost.  I'll have to tap out if you cannot regroup and show concrete examples of logs that happen for each case.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 00:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329930#M5855</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-09-12T00:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get duration between a start and stop event and trigger an alert if duration is greater than 5 minutes?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329931#M5856</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3479i6CD22AB4BA5EA787/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;i've attached a screenshot and i hope that helps.the blue highlighted part is what i am looking for.as you can see from the data, the service in question stops and starts in seconds,but when it doesn't ,all hell brakes loose.so if possible i want to be alerted thru splunk when that happens.as the pattern shows from the log that service recovers fairly quick and if not, like the one below i wanna pull that information from the log file which is windows application event log.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 00:49:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-get-duration-between-a-start-and-stop-event-and-trigger/m-p/329931#M5856</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-12T00:49:35Z</dc:date>
    </item>
  </channel>
</rss>

