<?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 How to calculate Job runtime? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606139#M14011</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a field 'JOB_STATUS' with the values as 'STARTING' and 'SUCCESS'.&amp;nbsp; With this I have to calculate the runtime.&lt;/P&gt;
&lt;P&gt;runtime=STARTING-SUCCESS&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you please let me know how to do this&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2022 15:04:11 GMT</pubDate>
    <dc:creator>MG</dc:creator>
    <dc:date>2022-07-19T15:04:11Z</dc:date>
    <item>
      <title>How to calculate Job runtime?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606139#M14011</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a field 'JOB_STATUS' with the values as 'STARTING' and 'SUCCESS'.&amp;nbsp; With this I have to calculate the runtime.&lt;/P&gt;
&lt;P&gt;runtime=STARTING-SUCCESS&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you please let me know how to do this&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 15:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606139#M14011</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-19T15:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606147#M14012</link>
      <description>&lt;P&gt;Presumably, these are different event?&lt;/P&gt;&lt;P&gt;Are the events link by a common id in another field, which is unique for each job?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 11:59:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606147#M14012</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-19T11:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606152#M14013</link>
      <description>&lt;P&gt;Please share some sample STARTING and SUCCESS events.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 12:07:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606152#M14013</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-07-19T12:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606159#M14014</link>
      <description>&lt;P&gt;7/19/22 12:44:40.000 PM&lt;BR /&gt;[07/19/2022 08:44:40] CAXXX_I_40245 EVENT: CHANGE_STATUS STATUS: STARTING JOB: PullMg_CreateHistory_job MACHINE: xxxxxxxxxx sourcetype = event_demon&lt;/P&gt;&lt;P&gt;7/19/22 12:47:42.000 PM&lt;BR /&gt;[07/19/2022 08:47:42] CAXXX_I_40245 EVENT: CHANGE_STATUS STATUS: SUCCESS JOB: PullMg_CreateHistory_job MACHINE: xxxxxxxxxx EXITCODE: 0 sourcetype = event_demon&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 12:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606159#M14014</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-19T12:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606160#M14015</link>
      <description>&lt;P&gt;There is no common field like jobid or other related items&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 12:50:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606160#M14015</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-19T12:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606162#M14016</link>
      <description>&lt;P&gt;How do you know which SUCCESS status relates to which STARTING status?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 13:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606162#M14016</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-19T13:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606179#M14017</link>
      <description>&lt;P&gt;Only value is JOB_Name&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 13:33:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606179#M14017</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-19T13:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606180#M14018</link>
      <description>&lt;P&gt;Assuming the machine name ties starting and finishing events, then this should help.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo ("STARTING" OR "SUCCESS")
| rex "JOB: (?&amp;lt;JOB&amp;gt;\S+)"
| rex "MACHINE: (?&amp;lt;MACHINE&amp;gt;\S+)"
| stats min(_time) as start, max(_time) as end by JOB MACHINE
| eval RUNTIME=end-start&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Jul 2022 13:41:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606180#M14018</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-07-19T13:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606183#M14020</link>
      <description>&lt;P&gt;I think i'm getting the result. But the time format is not in the actual time format.how to convert it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;start end runtime&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="40px"&gt;1658235600&lt;/TD&gt;&lt;TD width="40px"&gt;1658235605&lt;/TD&gt;&lt;TD width="107px"&gt;5&lt;/TD&gt;&lt;TD width="180px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="40px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 19 Jul 2022 13:55:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606183#M14020</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-19T13:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606184#M14021</link>
      <description>&lt;LI-CODE lang="markup"&gt;| fieldformat start=strftime(start,"%F %T")
| fieldformat end=strftime(end,"%F %T")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Jul 2022 13:57:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606184#M14021</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-19T13:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606187#M14022</link>
      <description>&lt;P&gt;Thanks..It worked&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 14:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606187#M14022</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-19T14:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606280#M14023</link>
      <description>&lt;P&gt;***The query given is clubbing all the start time and endtime for each job and not giving the actual result**&lt;/P&gt;&lt;P&gt;One of the job is running every 5min a day and these are the events.&lt;/P&gt;&lt;P&gt;index=foo JOB_4185_u (STARTING OR SUCCESS)&lt;BR /&gt;|table JOB MACHINE _time STATUS&lt;/P&gt;&lt;TABLE width="788"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="469"&gt;&lt;A href="https://spglobal.splunkcloud.com/en-US/app/spgi_public_search/search?q=search%20index%3Dspgi_corp_app_autoiws_prod%20p_mi_xf_t_CIQEstimateCoreV2SpanNA_4185_u%20(STARTING%20OR%20SUCCESS)%0A%7Ctable%20JOB%20MACHINE%20_time%20STATUS&amp;amp;display.page.search.mode=verbose&amp;amp;dispatch.sample_ratio=1&amp;amp;workload_pool=standard_perf&amp;amp;earliest=-24h%40h&amp;amp;latest=now&amp;amp;display.page.search.tab=statistics&amp;amp;display.general.type=statistics&amp;amp;sid=1658296215.23762_38485A5C-FE07-4310-9034-AB7202F57E45" target="_blank" rel="noopener"&gt;JOB&lt;/A&gt;&lt;/TD&gt;&lt;TD width="97"&gt;MACHINE&lt;/TD&gt;&lt;TD width="111"&gt;&lt;A href="https://spglobal.splunkcloud.com/en-US/app/spgi_public_search/search?q=search%20index%3Dspgi_corp_app_autoiws_prod%20p_mi_xf_t_CIQEstimateCoreV2SpanNA_4185_u%20(STARTING%20OR%20SUCCESS)%0A%7Ctable%20JOB%20MACHINE%20_time%20STATUS&amp;amp;display.page.search.mode=verbose&amp;amp;dispatch.sample_ratio=1&amp;amp;workload_pool=standard_perf&amp;amp;earliest=-24h%40h&amp;amp;latest=now&amp;amp;display.page.search.tab=statistics&amp;amp;display.general.type=statistics&amp;amp;sid=1658296215.23762_38485A5C-FE07-4310-9034-AB7202F57E45" target="_blank" rel="noopener"&gt;_time&lt;/A&gt;&lt;/TD&gt;&lt;TD width="111"&gt;STATUS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine1&lt;/TD&gt;&lt;TD width="111"&gt;20-07-2022 03:31&lt;/TD&gt;&lt;TD width="111"&gt;SUCCESS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine2&lt;/TD&gt;&lt;TD width="111"&gt;20-07-2022 00:22&lt;/TD&gt;&lt;TD width="111"&gt;SUCCESS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine1&lt;/TD&gt;&lt;TD width="111"&gt;19-07-2022 23:45&lt;/TD&gt;&lt;TD width="111"&gt;STARTING&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine1&lt;/TD&gt;&lt;TD width="111"&gt;19-07-2022 23:21&lt;/TD&gt;&lt;TD width="111"&gt;SUCCESS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine2&lt;/TD&gt;&lt;TD width="111"&gt;19-07-2022 20:31&lt;/TD&gt;&lt;TD width="111"&gt;SUCCESS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine1&lt;/TD&gt;&lt;TD width="111"&gt;19-07-2022 11:46&lt;/TD&gt;&lt;TD width="111"&gt;SUCCESS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine1&lt;/TD&gt;&lt;TD width="111"&gt;19-07-2022 11:45&lt;/TD&gt;&lt;TD width="111"&gt;STARTING&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine2&lt;/TD&gt;&lt;TD width="111"&gt;19-07-2022 11:00&lt;/TD&gt;&lt;TD width="111"&gt;STARTING&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine1&lt;/TD&gt;&lt;TD width="111"&gt;19-07-2022 08:41&lt;/TD&gt;&lt;TD width="111"&gt;SUCCESS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="469"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="97"&gt;Machine2&lt;/TD&gt;&lt;TD width="111"&gt;20-07-2022 04:07&lt;/TD&gt;&lt;TD width="111"&gt;STARTING&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in the query , it is summing up all the starttime and end time for a job and giving it as a table with only two statistics eventhough there are 557 events matching.&lt;/P&gt;&lt;P&gt;index=foo JOB_4185_u (STARTING OR SUCCESS)&lt;BR /&gt;|stats min(_time) as STARTTIME,max(_time) as ENDTIME by JOB MACHINE&lt;BR /&gt;|fieldformat STARTTIME=strftime(STARTTIME,"%F %T")&lt;BR /&gt;|fieldformat ENDTIME=strftime(ENDTIME,"%F %T")&lt;BR /&gt;|eval RUNTIME=ENDTIME-STARTTIME&lt;BR /&gt;|table JOB MACHINE STARTTIME ENDTIME RUNTIME STATUS&lt;/P&gt;&lt;TABLE width="469"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="469"&gt;&lt;P&gt;Complete&amp;nbsp;557&amp;nbsp;events&amp;nbsp;(7/19/22 5:00:00.000 AM to 7/20/22 5:18:44.000 AM)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE width="509px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="107px"&gt;&lt;P&gt;JOB&lt;/P&gt;&lt;/TD&gt;&lt;TD width="81px"&gt;MACHINE&lt;/TD&gt;&lt;TD width="95px"&gt;STARTTIME&lt;/TD&gt;&lt;TD width="78px"&gt;ENDTIME&lt;/TD&gt;&lt;TD width="80px"&gt;RUNTIME&lt;/TD&gt;&lt;TD width="68px"&gt;STATUS&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="107px"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="81px"&gt;xxxxx&lt;/TD&gt;&lt;TD width="95px"&gt;19-07-2022 05:20&lt;/TD&gt;&lt;TD width="78px"&gt;20-07-2022 05:16&lt;/TD&gt;&lt;TD width="80px"&gt;86197&lt;/TD&gt;&lt;TD width="68px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="107px"&gt;JOB_4185_u&lt;/TD&gt;&lt;TD width="81px"&gt;xxxxxxx&lt;/TD&gt;&lt;TD width="95px"&gt;19-07-2022 05:00&lt;/TD&gt;&lt;TD width="78px"&gt;20-07-2022 05:11&lt;/TD&gt;&lt;TD width="80px"&gt;87103&lt;/TD&gt;&lt;TD width="68px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 06:06:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606280#M14023</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-20T06:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606286#M14024</link>
      <description>&lt;P&gt;Your example data has inconsistent numbers and orders of STARTING and SUCCESS - assuming this is just a typo and that for each STARTING there will be a SUCCESS, try this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| sort 0 JOB MACHINE _time
| streamstats range(_time) as duration first(STATUS) as previousSTATUS window=2 global=f by JOB MACHINE
| where STATUS="SUCCESS" AND previousSTATUS="STARTING"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Jul 2022 06:34:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606286#M14024</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-20T06:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606296#M14025</link>
      <description>&lt;P&gt;But how to separate start_time and end_time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;|table JOB, STARTTIME,ENDTIME,RUNTIME&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 07:14:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606296#M14025</guid>
      <dc:creator>MG</dc:creator>
      <dc:date>2022-07-20T07:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Job runtime</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606300#M14026</link>
      <description>&lt;LI-CODE lang="markup"&gt;| sort 0 JOB MACHINE _time
| streamstats min(_time) as STARTTIME range(_time) as RUNTIME first(STATUS) as previousSTATUS window=2 global=f by JOB MACHINE
| where STATUS="SUCCESS" AND previousSTATUS="STARTING"
| rename _time as ENDTIME
| table JOB STARTTIME ENDTIME RUNTIME&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 20 Jul 2022 07:20:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-Job-runtime/m-p/606300#M14026</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-20T07:20:24Z</dc:date>
    </item>
  </channel>
</rss>

