<?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: Conditional transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339078#M100540</link>
    <description>&lt;P&gt;What is the use case for only joining pairs?  If bar and baz should be combined, why not bar, baz, bak and ban?&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 13:41:48 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-09-18T13:41:48Z</dc:date>
    <item>
      <title>Conditional transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339077#M100539</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have two types of events: clicks and searches.&lt;BR /&gt;
I want to group two searches into a transaction if&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;they don't have any other events in between&lt;/LI&gt;
&lt;LI&gt;they are within 5 seconds from each other&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Input:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;time=1505404370 query=foo type=search
time=1505404371 query=foo type=click
time=1505404372 query=bar type=search
time=1505404373 query=baz type=search
time=1505404374 query=bak type=search
time=1505404375 query=ban type=search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;time=1505404372 query=bar type=search
time=1505404373 query=baz type=search
--------------------
time=1505404374 query=bak type=search
time=1505404375 query=ban type=search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Sep 2017 16:15:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339077#M100539</guid>
      <dc:creator>ablake1</dc:creator>
      <dc:date>2017-09-14T16:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339078#M100540</link>
      <description>&lt;P&gt;What is the use case for only joining pairs?  If bar and baz should be combined, why not bar, baz, bak and ban?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 13:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339078#M100540</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-18T13:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339079#M100541</link>
      <description>&lt;P&gt;It's needed for further analysis.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 13:43:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339079#M100541</guid>
      <dc:creator>ablake1</dc:creator>
      <dc:date>2017-09-18T13:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339080#M100542</link>
      <description>&lt;P&gt;Here's one way.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rename COMMENT as "Sort in ascending order, copy time and previous type to each new record."
| sort 0 _time
| streamstats current=f window=1 last(_time) as prevtime last(type) as prevtype

| rename COMMENT as "It is a new group if it is the first group, if type changes, or if there had been 5 seconds."
| eval groupchange=case(isnull(prevtype),1, prevtype!=type,1, _time-prevtime&amp;gt;5,1, true(),0)

| rename COMMENT as "Determine the group number, kill groups that aren't search"
| streamstats sum(groupchange) as groupno
| eval groupno = if(type="search",groupno,null())

| rename COMMENT as "Add up the members of each group, pair them off, keep only pairs"
| streamstats count as countoff by groupno
| eval mygroup = floor((countoff+1)/2,0)
| eventstats count as paircheck by groupno mygroup
| where paircheck=2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2017 14:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339080#M100542</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-18T14:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339081#M100543</link>
      <description>&lt;P&gt;updated line 15 to &lt;CODE&gt;by groupno mygroup&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 14:05:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conditional-transaction/m-p/339081#M100543</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-09-18T14:05:49Z</dc:date>
    </item>
  </channel>
</rss>

