<?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 combine two consecutive events into one based on the content of the first event? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262648#M78848</link>
    <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I would like to combine 2 events into one based on the content of the first one.&lt;/P&gt;

&lt;P&gt;So every time I find an event containing the word "Banana" I wanna combine it with the line that follows regardless of what the following line is.&lt;/P&gt;

&lt;P&gt;Could you please help out? &lt;/P&gt;

&lt;P&gt;Thank you.&lt;BR /&gt;
David&lt;/P&gt;</description>
    <pubDate>Fri, 04 Dec 2015 14:11:46 GMT</pubDate>
    <dc:creator>DavidHourani</dc:creator>
    <dc:date>2015-12-04T14:11:46Z</dc:date>
    <item>
      <title>How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262648#M78848</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I would like to combine 2 events into one based on the content of the first one.&lt;/P&gt;

&lt;P&gt;So every time I find an event containing the word "Banana" I wanna combine it with the line that follows regardless of what the following line is.&lt;/P&gt;

&lt;P&gt;Could you please help out? &lt;/P&gt;

&lt;P&gt;Thank you.&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 14:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262648#M78848</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2015-12-04T14:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262649#M78849</link>
      <description>&lt;P&gt;Can you put some sample data here? The closer to your original data the better&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 14:20:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262649#M78849</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2015-12-04T14:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262650#M78850</link>
      <description>&lt;P&gt;Hello. You can do it through configuration files (&lt;STRONG&gt;props.conf&lt;/STRONG&gt; and &lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;). Read this:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.1511/Data/Configureeventlinebreaking"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.1511/Data/Configureeventlinebreaking&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 14:20:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262650#M78850</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-12-04T14:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262651#M78851</link>
      <description>&lt;P&gt;You could try the transaction command. Something like this could work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | transaction startswith="banana" maxevents=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Having said this, keep in mind the sort order in splunk may not be the same as what you are thinking. So what you think as the "next" event may not be what splunk considers to be the "next" event. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 15:30:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262651#M78851</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-04T15:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262652#M78852</link>
      <description>&lt;P&gt;I think that should work. I did it with &lt;CODE&gt;|transaction _time startswith="banana"  endwith="the keyword in the next even"&lt;/CODE&gt;  since the "Next" event was in chronological order worked fine for me ^^ &lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 19:05:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262652#M78852</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2015-12-04T19:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262653#M78853</link>
      <description>&lt;P&gt;You should try to avoid using &lt;CODE&gt;transaction&lt;/CODE&gt; whenever you can.  Try this instead (faster and more robust):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... "banana" OR "the keyword in the next event" | reverse | streamstats count(eval(searchmatch("banana"))) AS SessionID | reverse | stats list(_raw) AS events by SessionID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Dec 2015 19:51:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262653#M78853</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-12-05T19:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262654#M78854</link>
      <description>&lt;P&gt;I'm getting 0 results with that search. I agree with you that transactions are slow and yes I think a better method would be to try to avoid it. How exactly does the Reverse command works ?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 09:24:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262654#M78854</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2015-12-07T09:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262655#M78855</link>
      <description>&lt;P&gt;We need &lt;CODE&gt;reverse&lt;/CODE&gt; so that as we work backwards through the list from top-to-bottom, we process the oldest events first, meaning that whenever we see a &lt;CODE&gt;banana&lt;/CODE&gt; event, it marks the beginning of a new "session".&lt;/P&gt;

&lt;P&gt;I made a mistake in that I used &lt;CODE&gt;stats&lt;/CODE&gt; instead of &lt;CODE&gt;streamstats&lt;/CODE&gt;.  I have correct this in my original answer; try again.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 16:28:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262655#M78855</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-12-08T16:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262656#M78856</link>
      <description>&lt;P&gt;its still not working for some reason... apparently SessionID is always empty...&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 12:10:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262656#M78856</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2015-12-09T12:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262657#M78857</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... "banana" OR "the keyword in the next event" | reverse | eval x=if(searchmatch("banana"), 1, 0) | streamstats sum(x) AS SessionID | reverse | stats list(_raw) AS events by SessionID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Dec 2015 14:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262657#M78857</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2015-12-09T14:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine two consecutive events into one based on the content of the first event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262658#M78858</link>
      <description>&lt;P&gt;ARGH!  I blew it &lt;EM&gt;again&lt;/EM&gt;!  I used &lt;CODE&gt;count(searchmatch("banana"))&lt;/CODE&gt; instead of &lt;CODE&gt;count(eval(searchmatch("banana")))&lt;/CODE&gt;.  I have updated my answer again.  If you care to retry, I am sure it will work this time!&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2015 20:41:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-two-consecutive-events-into-one-based-on-the/m-p/262658#M78858</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-12-09T20:41:02Z</dc:date>
    </item>
  </channel>
</rss>

