<?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: Average time between two jobs. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351228#M166029</link>
    <description>&lt;P&gt;i added the screenshot at the bottom of the page.i still need to be able to get just the messages where time between stop services and start services is more than 10 minutes.i'd like to omit the results where there is just start services coming as well.&lt;/P&gt;

&lt;P&gt;i want to create an alert when this service doesn't start in 10 minutes so service desk would get an email and manually start the service.&lt;/P&gt;

&lt;P&gt;thanks,&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2017 12:58:52 GMT</pubDate>
    <dc:creator>carlyleadmin</dc:creator>
    <dc:date>2017-10-04T12:58:52Z</dc:date>
    <item>
      <title>Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351209#M166010</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Here is my search query;&lt;/P&gt;

&lt;P&gt;index=* sourcetype="WMI:WinEventLog:Application" SourceName="Investran RS Word Processing Service" Message=* | table Message , SourceName  _time |dedup _time |sort -_time&lt;/P&gt;

&lt;P&gt;and this brings up ;&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/217585-search.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;So what i am trying to do if possible is,calculate the average time between stop/start.and if that average is greater than lets say 10 mins only bring that results/messages&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:53:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351209#M166010</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2020-09-29T15:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351210#M166011</link>
      <description>&lt;P&gt;Try this -&lt;/P&gt;

&lt;P&gt;|eval t=strftime(_time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| eval t1=strptime(t,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
|  streamstats current=false last(t1) as prevt1&lt;BR /&gt;
| eval diff=round((prevt1-t1)*60/3600,2)| where diff &amp;gt;10&lt;BR /&gt;
| table Message,Soucename,_time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:49:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351210#M166011</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-29T15:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351211#M166012</link>
      <description>&lt;P&gt;Hey @carlyleadmin, If @Sukisen1981's solution worked then please don't forget to accept their answer to award karma points and close the question. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:19:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351211#M166012</guid>
      <dc:creator>lfedak_splunk</dc:creator>
      <dc:date>2017-09-20T19:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351212#M166013</link>
      <description>&lt;P&gt;Thanks for the quick reply sukisen1981.i will try it and let you know.even if it doesn't work i will accept it and give you points:)but i am hoping that we can keep the case open if possible&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:23:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351212#M166013</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-20T19:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351213#M166014</link>
      <description>&lt;P&gt;i hope we can keep the case open for couple days untill i give this a try.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 19:24:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351213#M166014</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-20T19:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351214#M166015</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The intent here is not to get points , but to make things work....This is a community where people ask / receive help, please feel free to revert back if the query does not work or you have difficulties in executing / understanding the query &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Suki&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 05:29:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351214#M166015</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-09-21T05:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351215#M166016</link>
      <description>&lt;P&gt;well i have to disagree with you suki.points are everything:)yes i am new to the splunk and there are so many functions to learn and your query is bit complicated for someone like me,and it takes time for me to learn it.i don't want to just copy paste the query,i wanna learn it as well.&lt;/P&gt;

&lt;P&gt;your query works in a way,but doesn't do what i really want it to do.if you look at the attached screenshot,i want the query to return the  highligted line/lines in my data.where the service stopped on 2017-09-13 13:57:49 and started back on 2017-09-15 14:25:47. as you can see the gap between 2 services are greater than 10 mins.your search returns mostly "service started" results and there are couple "service stopped" ones as well,but that does not help me.i need that correlation.stop-start time&amp;gt;10-15 mins.i hope this is clear,but if you need more time think about it and don't understand the question, it is okay,take your time:)&lt;/P&gt;

&lt;P&gt;the only reason i asked the case to be kept open so i could tweak your search query and maybe make it work the way i wanted.your query does not work completely and as you mentioned, this is a community where people ask/receive help(points) i shall take your point back:)&lt;/P&gt;

&lt;P&gt;Thanks!!!!&lt;/P&gt;

&lt;P&gt;Thanks!!!!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 11:20:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351215#M166016</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-21T11:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351216#M166017</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/3529i9B9225BB8FE69CC5/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 forgot to add the screenshot&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 11:24:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351216#M166017</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-21T11:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351217#M166018</link>
      <description>&lt;P&gt;can you please reattach the screen shot?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 11:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351217#M166018</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-09-21T11:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351218#M166019</link>
      <description>&lt;P&gt;well this shouldn't take too much time.&lt;BR /&gt;
look at my query:&lt;BR /&gt;
|eval t=strftime(_time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| eval t1=strptime(t,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| streamstats current=false last(t1) as prevt1&lt;BR /&gt;
| eval diff=round((prevt1-t1)*60/3600,2)| where diff &amp;gt;10&lt;BR /&gt;
| table Message,Soucename,_time&lt;/P&gt;

&lt;P&gt;the streamstats is pulling the previous time as prevt1, now you can add a , after prevt1 and add  something like - &lt;BR /&gt;
streamstats current=false last(t1) as prevt1 , current=false last(Mesage) as prevmsg..this will fetch the previous message and the previous time&lt;BR /&gt;
now , in the eval :&lt;BR /&gt;
eval diff=round((prevt1-t1)*60/3600,2)| where diff &amp;gt;10 AND prevmsg ="Service started successfully" AND Message="Service stopped successfully"... this will give you ONLY rows having service stop AND previous row was service start AND diff between the time stamps is &amp;gt;10..try it out no reason it won't work.&lt;/P&gt;

&lt;P&gt;I am not going into the whole points debate, it is not worth it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  but trying out and tweaking the query is definitely worth it, which you already seem eager to explore...Happy Splunking &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:54:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351218#M166019</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-29T15:54:06Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351219#M166020</link>
      <description>&lt;P&gt;and this is what i get when i run your query.mostly just "service started" results&lt;/P&gt;

&lt;P&gt;thanks.![alt text][2]&lt;/P&gt;

&lt;P&gt;![![alt text][2]][1]  [2]: /storage/temp/217606-start-search.png&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 11:46:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351219#M166020</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-21T11:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351220#M166021</link>
      <description>&lt;P&gt;Thanks Suki.all is good.and like i said, i am not as experienced as you guys and that's why i am here:)i just started using splunk couple weeks ago and i am amazed what it can do.such a powerful tool.Thanks for all the help.&lt;/P&gt;

&lt;P&gt;Happy Splunking:)&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 11:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351220#M166021</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-09-21T11:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351221#M166022</link>
      <description>&lt;P&gt;Hey Sukisen,&lt;/P&gt;

&lt;P&gt;this is what i am running but not getting anything."No result found"&lt;/P&gt;

&lt;P&gt;source="WinEventLog:Application" host=xxxx SourceName="Investran RS Word Processing Service" Message=*|eval t=strftime(_time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| eval t1=strptime(t,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| streamstats current=false last(t1) as prevt1, last(Message) as prevmsg|eval diff=round((prevt1-t1)*60/3600,2)| where diff&amp;gt;10 AND prevmsg="Service started successfully" AND Message="Service stopped successfully"| table Message,SourceName,_time&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351221#M166022</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2020-09-29T16:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351222#M166023</link>
      <description>&lt;P&gt;Can you help please?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 20:18:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351222#M166023</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-10-03T20:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351223#M166024</link>
      <description>&lt;P&gt;can you please try removing the pipes starting one by one before the first eval and let me know after which pipe the search first returns no results?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 20:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351223#M166024</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-10-03T20:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351224#M166025</link>
      <description>&lt;P&gt;i get results up to this point;&lt;BR /&gt;
source="WinEventLog:Application" host=HC1APTR2CV SourceName="Investran RS Word Processing Service" Message=*|eval t=strftime(_time,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| eval t1=strptime(t,"%Y-%m-%d %H:%M:%S")&lt;BR /&gt;
| streamstats current=false last(t1) as prevt1, last(Message) as prevmsg|eval diff=round((prevt1-t1)*60/3600,2)&lt;/P&gt;

&lt;P&gt;after that it fails.is that what you asked for?&lt;BR /&gt;
thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:01:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351224#M166025</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2020-09-29T16:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351225#M166026</link>
      <description>&lt;P&gt;so if i add:&lt;/P&gt;

&lt;P&gt;| where diff &amp;gt;10 AND prevmsg ="Service started successfully" AND Message="Service stopped successfully"&lt;/P&gt;

&lt;P&gt;i dont get any results&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 20:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351225#M166026</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-10-03T20:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351226#M166027</link>
      <description>&lt;P&gt;yes ..cool can you remove  the |where....&lt;BR /&gt;
nd just modify |table... to&lt;BR /&gt;
table Message,SourceName,_time,diff,prevmsg..?&lt;BR /&gt;
I need the output..is diff n prevmesg values returned in the table?&lt;BR /&gt;
plz attacha screen shot of the output from the statistics table if possible&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 20:45:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351226#M166027</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-10-03T20:45:41Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351227#M166028</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/3530i323BB466D8CF3E8A/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 12:53:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351227#M166028</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-10-04T12:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: Average time between two jobs.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351228#M166029</link>
      <description>&lt;P&gt;i added the screenshot at the bottom of the page.i still need to be able to get just the messages where time between stop services and start services is more than 10 minutes.i'd like to omit the results where there is just start services coming as well.&lt;/P&gt;

&lt;P&gt;i want to create an alert when this service doesn't start in 10 minutes so service desk would get an email and manually start the service.&lt;/P&gt;

&lt;P&gt;thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 12:58:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Average-time-between-two-jobs/m-p/351228#M166029</guid>
      <dc:creator>carlyleadmin</dc:creator>
      <dc:date>2017-10-04T12:58:52Z</dc:date>
    </item>
  </channel>
</rss>

