<?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 Start and Endtimes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501061#M139540</link>
    <description>&lt;P&gt;I have this scenario:&lt;/P&gt;

&lt;P&gt;log 1: contains -&lt;/P&gt;

&lt;P&gt;message: "app started"&lt;BR /&gt;
_time: 1234&lt;/P&gt;

&lt;P&gt;log 2:&lt;BR /&gt;
message: "ended"&lt;BR /&gt;
_time: 1235&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex to extract app from log1 and name it app|eval start_time=strftime(_time, "%d-%m-%Y %H:%M:%S") | rex to extract ended from log2 and name it app1|eval end_time=strftime(_time, "%d-%m-%Y %H:%M:%S")| stats values(app) AS app values(app1) as app1 values(start_time) values(endtime) by _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So when I extracted value of message and time in both logs, I end up in a situation with something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app app1 start_time end_time
A               1234          1234
         A      1235          1235
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I am looking for this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app app1 start_time end_time
A      A       1234          1235
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first occurence of A in app field will be the start details and the first occurence of A in app1 will have the end_time and both should be on the same row. After that, go to the next row and repeat for other occurence of A or what ever is in app field and app1 field in the same way. &lt;BR /&gt;
I would like your help on this. &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 26 Mar 2020 18:52:17 GMT</pubDate>
    <dc:creator>ibekacyril</dc:creator>
    <dc:date>2020-03-26T18:52:17Z</dc:date>
    <item>
      <title>Start and Endtimes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501061#M139540</link>
      <description>&lt;P&gt;I have this scenario:&lt;/P&gt;

&lt;P&gt;log 1: contains -&lt;/P&gt;

&lt;P&gt;message: "app started"&lt;BR /&gt;
_time: 1234&lt;/P&gt;

&lt;P&gt;log 2:&lt;BR /&gt;
message: "ended"&lt;BR /&gt;
_time: 1235&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex to extract app from log1 and name it app|eval start_time=strftime(_time, "%d-%m-%Y %H:%M:%S") | rex to extract ended from log2 and name it app1|eval end_time=strftime(_time, "%d-%m-%Y %H:%M:%S")| stats values(app) AS app values(app1) as app1 values(start_time) values(endtime) by _time 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So when I extracted value of message and time in both logs, I end up in a situation with something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app app1 start_time end_time
A               1234          1234
         A      1235          1235
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I am looking for this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app app1 start_time end_time
A      A       1234          1235
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The first occurence of A in app field will be the start details and the first occurence of A in app1 will have the end_time and both should be on the same row. After that, go to the next row and repeat for other occurence of A or what ever is in app field and app1 field in the same way. &lt;BR /&gt;
I would like your help on this. &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 18:52:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501061#M139540</guid>
      <dc:creator>ibekacyril</dc:creator>
      <dc:date>2020-03-26T18:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Start and Endtimes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501062#M139541</link>
      <description>&lt;P&gt;You can use the &lt;CODE&gt;coalesce&lt;/CODE&gt; function to combine the app and app1 fields.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex to extract app from log1 and name it app
|eval start_time=strftime(_time, "%d-%m-%Y %H:%M:%S") 
| rex to extract ended from log2 and name it app1
|eval end_time=strftime(_time, "%d-%m-%Y %H:%M:%S")
| eval app=coalesce(app, app1) 
| stats values(app) AS app  values(start_time) values(endtime) by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Mar 2020 00:49:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501062#M139541</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-03-27T00:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Start and Endtimes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501063#M139542</link>
      <description>&lt;P&gt;So I ended up using using transaction command before using the streamstats. However, I ended up with this table format. &lt;/P&gt;

&lt;P&gt;app app1 start_time end_time&lt;BR /&gt;
A.     A.      1234           1234&lt;BR /&gt;
B.     B.      1238.           1253&lt;BR /&gt;
C.     C.       1345.           1345&lt;/P&gt;

&lt;P&gt;So now I need to check if both start_time and end_time have the same values and if yes, remove it in the final table. Seems that's the final step for me. &lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:43:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501063#M139542</guid>
      <dc:creator>ibekacyril</dc:creator>
      <dc:date>2020-09-30T04:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Start and Endtimes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501064#M139543</link>
      <description>&lt;P&gt;Hello @richgalloway, can you check my comment above? Thank you in advance&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 02:27:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501064#M139543</guid>
      <dc:creator>ibekacyril</dc:creator>
      <dc:date>2020-03-27T02:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Start and Endtimes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501065#M139544</link>
      <description>&lt;P&gt;&lt;CODE&gt;... | where start_time != end_time&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 12:36:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Start-and-Endtimes/m-p/501065#M139544</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-03-27T12:36:41Z</dc:date>
    </item>
  </channel>
</rss>

