<?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: combine events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312692#M164783</link>
    <description>&lt;P&gt;The first part of stats &lt;CODE&gt;values(message.CreationDate) as CreationDate&lt;/CODE&gt; should give you both the CreationDate values, unless both are same. you should be getting duration=0 in that case. If that's what happened, then use &lt;CODE&gt;list(message.CreationDate) as CreationDate&lt;/CODE&gt; instead in your stats.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Nov 2017 15:50:42 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-11-28T15:50:42Z</dc:date>
    <item>
      <title>combine events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312689#M164780</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am working on a search. The data consists of requests and answers. The answer and the request have the same unique ID (message.MessageId). Each request and answer has a message.RequestId. The answer also has an message.PreviousRequestId which is the initial message.RequestId from the request.&lt;BR /&gt;
I need to monitor whether each request has received (or not) an answer and measure the time between them (using message.CreationDate). So far i have got this :&lt;/P&gt;

&lt;P&gt;...search.... &lt;BR /&gt;
| transaction message.MessageId &lt;BR /&gt;
| table message.MessageId  message.CreationDate message.location message.RequestId message.PreviousRequestId&lt;BR /&gt;
This reults in events combining the request and the answer like this:&lt;BR /&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/3938iB61F920C383F8746/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
What i would like (if possible) is that per messageId i get on line with the different values so i can calculate the difference&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2017 15:28:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312689#M164780</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-27T15:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: combine events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312690#M164781</link>
      <description>&lt;P&gt;The transaction command would automatically calculate the difference in the field &lt;CODE&gt;duration&lt;/CODE&gt;. So adding that to your table command would do for you here. &lt;/P&gt;

&lt;P&gt;But transaction commands are really expensive. Since, your transactions have just two events with no complicated conditions, you can try this more efficient alternative as well.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...search.... 
| eval epochCreationDate=strptime('message.CreationDate',"%Y-%m-%dT%H:%M:%S.%N%z")
| stats values(message.CreationDate) as CreationDate values(message.location) as Location values(message.RequestId) as RequestId values(message.PreviousRequestId) as PreviousRequestId range(epochCreationDate) as Duration by message.MessageId 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Nov 2017 17:17:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312690#M164781</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-27T17:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: combine events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312691#M164782</link>
      <description>&lt;P&gt;Hi, this gives me duration but ik still get the results as i got them earlier (like in the screenshot) i still miss both the creationdates&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 15:10:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312691#M164782</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-28T15:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: combine events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312692#M164783</link>
      <description>&lt;P&gt;The first part of stats &lt;CODE&gt;values(message.CreationDate) as CreationDate&lt;/CODE&gt; should give you both the CreationDate values, unless both are same. you should be getting duration=0 in that case. If that's what happened, then use &lt;CODE&gt;list(message.CreationDate) as CreationDate&lt;/CODE&gt; instead in your stats.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 15:50:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312692#M164783</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-28T15:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: combine events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312693#M164784</link>
      <description>&lt;P&gt;If I use:&lt;BR /&gt;
| eval epochCreationDate=strptime('message.CreationDate',"%Y-%m-%dT%H:%M:%S.%N%z")&lt;BR /&gt;
 | stats list(message.CreationDate) as CreationDate |stats values(message.location) as Location values(message.RequestId) as RequestId values(message.PreviousRequestId) as PreviousRequestId range(epochCreationDate) as Duration by message.MessageId&lt;/P&gt;

&lt;P&gt;I get  'no results'&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 16:27:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312693#M164784</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-28T16:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: combine events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312694#M164785</link>
      <description>&lt;P&gt;It should be included in existing stats, not a new one. Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...search.... 
 | eval epochCreationDate=strptime('message.CreationDate',"%Y-%m-%dT%H:%M:%S.%N%z")
 | stats list(message.CreationDate) as CreationDate values(message.location) as Location values(message.RequestId) as RequestId values(message.PreviousRequestId) as PreviousRequestId range(epochCreationDate) as Duration by message.MessageId 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Nov 2017 16:41:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312694#M164785</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-11-28T16:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: combine events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312695#M164786</link>
      <description>&lt;P&gt;Great, it works. Ony thing is that 'list' has a maximum. &lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 10:57:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/combine-events/m-p/312695#M164786</guid>
      <dc:creator>Mike6960</dc:creator>
      <dc:date>2017-11-29T10:57:42Z</dc:date>
    </item>
  </channel>
</rss>

