<?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 do I combine start time from one event and end time in another and display the stats table in one row? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390485#M166637</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/6105iDACB6E87249980EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following search that generates the below table. How do i get the starting timestamp and the Success or Failure timestamp in the same row as the starting timestamp when these values are all in separate events (one event has start time of job X, next has success/failure time of job X). They will also need to be associated in the right order. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX source=XXX jobName=XXX

| where statusText="SUCCESS" or statusText="STARTING" or statusText="FAILURE"
| eval startTime=if(statusText=="STARTING",timestamp,null)
| eval failureTime=if(statusText=="FAILURE",timestamp,null)
| eval successTime=if(statusText=="SUCCESS",timestamp,null)
| table jobName startTime successTime failureTime
| rename startTime as "Start Time" successTime as "Success Time" failureTime as "Failure Time"
&lt;/CODE&gt;&lt;/PRE&gt;

&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/6106i76B1AF08A5EAD5E2/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>Sun, 11 Nov 2018 23:58:33 GMT</pubDate>
    <dc:creator>x213217</dc:creator>
    <dc:date>2018-11-11T23:58:33Z</dc:date>
    <item>
      <title>How do I combine start time from one event and end time in another and display the stats table in one row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390485#M166637</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/6105iDACB6E87249980EC/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have the following search that generates the below table. How do i get the starting timestamp and the Success or Failure timestamp in the same row as the starting timestamp when these values are all in separate events (one event has start time of job X, next has success/failure time of job X). They will also need to be associated in the right order. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX source=XXX jobName=XXX

| where statusText="SUCCESS" or statusText="STARTING" or statusText="FAILURE"
| eval startTime=if(statusText=="STARTING",timestamp,null)
| eval failureTime=if(statusText=="FAILURE",timestamp,null)
| eval successTime=if(statusText=="SUCCESS",timestamp,null)
| table jobName startTime successTime failureTime
| rename startTime as "Start Time" successTime as "Success Time" failureTime as "Failure Time"
&lt;/CODE&gt;&lt;/PRE&gt;

&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/6106i76B1AF08A5EAD5E2/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>Sun, 11 Nov 2018 23:58:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390485#M166637</guid>
      <dc:creator>x213217</dc:creator>
      <dc:date>2018-11-11T23:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine start time from one event and end time in another and display the stats table in one row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390486#M166638</link>
      <description>&lt;P&gt;@x213217,&lt;/P&gt;

&lt;P&gt;Try adding this to your search before the last line in your search (rename)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|streamstats last(successTime) as prev_successTime,last(failureTime) as prev_failuretime current=f window=1|where startTime!=""
|eval successTime=coalesce(prev_successtime,successTime),failureTime=coalesce(prev_failuretime,failureTime)|fields - prev*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Final search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=XXX source=XXX jobName=XXX
| where statusText="SUCCESS" or statusText="STARTING" or statusText="FAILURE"
| eval startTime=if(statusText=="STARTING",timestamp,null)
| eval failureTime=if(statusText=="FAILURE",timestamp,null)
| eval successTime=if(statusText=="SUCCESS",timestamp,null)
| table jobName startTime successTime failureTime
| streamstats last(startTime) as prev_successTime,last(failureTime) as prev_failuretime current=f window=1|where startTime!=""
| eval successTime=coalesce(prev_successtime,successTime),failureTime=coalesce(prev_failuretime,failureTime)|fields - prev*
| rename startTime as "Start Time" successTime as "Success Time" failureTime as "Failure Time"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Nov 2018 12:46:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390486#M166638</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-11-12T12:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine start time from one event and end time in another and display the stats table in one row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390487#M166639</link>
      <description>&lt;P&gt;Hello and thank you for your response - I believe this is very close - However it seems to be leaving out the successTime as you can see in the new screenshot i posted above&lt;/P&gt;

&lt;P&gt;the startTime seems to match up with the failure time but for events with the SUCCESS timestamp it does not appear in the table? any suggestions on how to fix this ?&lt;/P&gt;

&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Nov 2018 15:04:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390487#M166639</guid>
      <dc:creator>x213217</dc:creator>
      <dc:date>2018-11-13T15:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine start time from one event and end time in another and display the stats table in one row?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390488#M166640</link>
      <description>&lt;P&gt;Nevermind got it to work! thanks&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where statusText="SUCCESS" OR statusText="STARTING" OR statusText="FAILURE"
| eval startTime=if(statusText=="STARTING",timestamp,null)
| eval failureTime=if(statusText=="FAILURE",timestamp,null)
| eval successTime=if(statusText=="SUCCESS",timestamp,null)
| streamstats last(successTime) as prev_successtime,last(failureTime) as prev_failuretime current=f window=1|where startTime!=""
| eval successTime=coalesce(prev_successtime,successTime),failureTime=coalesce(prev_failuretime,failureTime)|fields - prev*
| table jobName startTime successTime failureTime
| rename startTime as "Start Time" successTime as "Success Time" failureTime as "Failure Time"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Nov 2018 15:10:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-start-time-from-one-event-and-end-time-in/m-p/390488#M166640</guid>
      <dc:creator>x213217</dc:creator>
      <dc:date>2018-11-13T15:10:47Z</dc:date>
    </item>
  </channel>
</rss>

