<?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 calculate job start/end time of transaction for particular time with an alert when it meets this criteria? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344859#M6081</link>
    <description>&lt;P&gt;one of the job is running from 12 to 5.In the time i need to find  start time and end time . &lt;BR /&gt;
for ex:  if the job starts at 12.30 i need to trigger email as job started .&lt;/P&gt;

&lt;P&gt;but for end time i dont know how to find end time and how to send mail for job completed .i dont have any start stop string  in the event&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2017 12:36:08 GMT</pubDate>
    <dc:creator>karthi2809</dc:creator>
    <dc:date>2017-09-21T12:36:08Z</dc:date>
    <item>
      <title>How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344857#M6079</link>
      <description>&lt;P&gt;how to calculate job start time and job  end time of transaction for particular time and to set trigger mail when start time  and stop time?&lt;BR /&gt;
This is my query ,i am getting  two events as start time and end time &lt;BR /&gt;
index=test  URI=/member* | head 1 | append [search index=test  URI=/member*| tail 1] | transaction URI&lt;/P&gt;

&lt;P&gt;How to send email when start time and end time&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 10:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344857#M6079</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2017-09-21T10:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344858#M6080</link>
      <description>&lt;P&gt;when exactly do you want to send an email? You can trigger it when specific conditions are met. Something like every time there is a start time AND end time (ie: two events or duration&amp;gt;0) or if the start time is after a certain hour of the day or on a certain day. can you be more specific?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 12:10:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344858#M6080</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-09-21T12:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344859#M6081</link>
      <description>&lt;P&gt;one of the job is running from 12 to 5.In the time i need to find  start time and end time . &lt;BR /&gt;
for ex:  if the job starts at 12.30 i need to trigger email as job started .&lt;/P&gt;

&lt;P&gt;but for end time i dont know how to find end time and how to send mail for job completed .i dont have any start stop string  in the event&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 12:36:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344859#M6081</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2017-09-21T12:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344860#M6082</link>
      <description>&lt;P&gt;can you give a sample of you data? you need a trigger every time a job starts and every time a job is completed? How do you know if the job is complete if there is no "complete" (or something similar) string? What metrics define a completed job?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 12:47:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344860#M6082</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-09-21T12:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344861#M6083</link>
      <description>&lt;P&gt;try this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test URI=/member* 
| stats min(_time) as starttime max(_time) as endtime range(_time) as duration by URI
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Duration will be in seconds.  &lt;/P&gt;

&lt;P&gt;However, that doesn't solve your question of sending the start and stop emails.  That just assumes that the last record for each will be the end record, which is what your original code was doing.&lt;/P&gt;

&lt;P&gt;It would be better to figure out what the records actually look like, and search for them directly.&lt;/P&gt;

&lt;P&gt;When you post those, we can help you work out the code.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 15:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344861#M6083</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-21T15:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344862#M6084</link>
      <description>&lt;P&gt;Hey @karthi2809, if DalJeanis solved your problem, please don't forget to accept an answer! You can upvote posts as well. (Karma points will be awarded for either action.) Happy Splunking!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 00:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344862#M6084</guid>
      <dc:creator>lfedak_splunk</dc:creator>
      <dc:date>2017-09-22T00:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344863#M6085</link>
      <description>&lt;P&gt;That only i dont know how to do.so i tried tail 1 command for last event time&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 04:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344863#M6085</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2017-09-22T04:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344864#M6086</link>
      <description>&lt;P&gt;When i use this query i have start time and stop time &lt;/P&gt;

&lt;P&gt;index=test_prod URI=/member*| eval StartTime=strftime(_time,"%Y/%m/%d %H:%M:%S")| head 1  | append [search index=test_prod URI=/member*| eval EndTime=strftime(_time,"%Y/%m/%d %H:%M:%S")| tail 1] | transaction URI&lt;/P&gt;

&lt;P&gt;9/20/17&lt;BR /&gt;
&lt;STRONG&gt;4:27:18.570 PM&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;
SPLUNK-TRACE-DateandTime - 2017-09-20 16:27:18.570 ThreadID=200;ThreadIDHex=00000;ThreadName=[WebContainer : 10];Node=MBR2:8448;meta-transid=INTERNAL_4f2d8b-11-48-8d-8e1776;ConsumerSenderID=NA;URI=/member*; TranasactionStartTime=2017-09-20 16:27:15.645;TransactionEndTime=2017-09-20 16:27:18.570;TransactionStatus=SUCCESS;Method=GET;StatusCode=200;Backend=;ErrorMsg=;JDBCInvocation=;JDBCWaitTime=;CacheContentFlag=UNKNOWN;CaptureLocation=Response; &lt;/P&gt;

&lt;P&gt;9/20/17&lt;BR /&gt;
&lt;STRONG&gt;12:30:10.908 PM&lt;/STRONG&gt; &lt;BR /&gt;
SPLUNK-TRACE-DateandTime - 2017-09-20 12:30:10.908 ThreadID=2084;ThreadIDHex=00000;ThreadName=[WebContainer : 2];Node=MBR8:8448;meta-transid=INTERNAL_f63e8-184e-49b-96d-8bbff0e5;ConsumerSenderID=NA;URI=/member*;TranasactionStartTime=2017-09-20 12:30:10.908;TransactionEndTime=NA;TransactionStatus=;Method=GET;StatusCode=;Backend=GetMber, GetContact-dal;ErrorMsg=;JDBCInvocation=;JDBCWaitTime=;CacheContentFlag=UNKNOWN;CaptureLocation=Request;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344864#M6086</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2020-09-29T15:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344865#M6087</link>
      <description>&lt;P&gt;@Karthi2809 -&lt;/P&gt;

&lt;P&gt;Easy enough.  All the records have TranasactionStartTime set to the same time. (Note the extra a in Tran &lt;CODE&gt;a&lt;/CODE&gt; saction in the events.) &lt;/P&gt;

&lt;P&gt;If you want to alert that the job has started, you need to key on the job where _time = TranasactionStartTime.  &lt;/P&gt;

&lt;P&gt;If you want to alert that the job has completed, you need to key on the event where _time = TransactionEndTime.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=test URI=/member* 
 | rename COMMENT as "Extract the times from the record" 
 | rex "TranasactionStartTime=(?&amp;lt;start&amp;gt;[^;]+);TransactionEndTime=(?&amp;lt;end&amp;gt;[^;N]*)(;|NA)"
 | eval tranStartTime=strftime(start,","%Y-%m-%d %H:%M:%s.%3N")
 | eval tranEndTime=strftime(end,","%Y-%m-%d %H:%M:%s.%3N")

 | rename COMMENT as "Group the records, clean up duration if the transaction has not completed." 
 | stats min(_time) as starttime, max(tranStartTime) as tranStartTime,
         max(_time) as nowtime, max(tranEndTime) as tranEndTime, range(_time) as duration by URI
 | eval duration=if(isnull(tranEndTime),null(),duration)

 | rename COMMENT as "If more records are possi ble than start and end, only let the start and end through." 
 | where (starttime=nowtime) OR (tranEndTime=nowtime) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Sep 2017 13:56:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344865#M6087</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-25T13:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate job start/end time of transaction for particular time with an alert when it meets this criteria?</title>
      <link>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344866#M6088</link>
      <description>&lt;P&gt;Hi Dal&lt;BR /&gt;
What if the TransactionEndTime is only in CaptureLocation=Response and TransactionStartTime is only in CaptureLocation=Request&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
AJ&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2017 00:13:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/How-to-calculate-job-start-end-time-of-transaction-for/m-p/344866#M6088</guid>
      <dc:creator>smilingajay</dc:creator>
      <dc:date>2017-10-18T00:13:53Z</dc:date>
    </item>
  </channel>
</rss>

