<?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: StartsWith breaks the transaction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465143#M131056</link>
    <description>&lt;P&gt;Thanks to the three of you for your quick input about my problem!&lt;BR /&gt;
I'm happily surprised of the reactivity on this forum, as this was my very first post...&lt;/P&gt;

&lt;P&gt;However, none of the solutions provided did work for me.&lt;BR /&gt;
@PavelP, although your solution seemed great, I got the same result as attached in previous screenshot. The response and request are not grouped in the same event when adding the &lt;CODE&gt;startswith&lt;/CODE&gt; ...&lt;/P&gt;

&lt;P&gt;@to4kawa and @woodcock , thank you for your suggestions, could you please explain me why &lt;CODE&gt;transaction&lt;/CODE&gt; is overkill for what I am trying to achieve?&lt;BR /&gt;
It's the only solution I have found in the Splunk documentation to match two corresponding events in the same splunk result.&lt;BR /&gt;
It enables me to see what is in each request and what is the associated response.&lt;BR /&gt;
&lt;CODE&gt;stats&lt;/CODE&gt; here is not the thing I am trying to achieve just yet.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 01 Apr 2020 17:51:34 GMT</pubDate>
    <dc:creator>gmasy</dc:creator>
    <dc:date>2020-04-01T17:51:34Z</dc:date>
    <item>
      <title>StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465138#M131051</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;I am trying to extract some data from the logs.&lt;BR /&gt;
I have created a little search that works well:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;customergetservice host=MBKBKKSPHTRSP0* source="/var/log/jbossas/standalone/server.log" | transaction RequestId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It links the request and the response from the server by the extracted field &lt;STRONG&gt;RequestId&lt;/STRONG&gt;.&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/8626iDEEBD55B34E21A33/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;However, I am trying to filter only some parameter contained in the field Login:&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/8627iC68C43732F0E6548/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The login has many possibilities of different values, but it starts with either:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;"BBC-*"&lt;/LI&gt;
&lt;LI&gt;"BBF-*"&lt;/LI&gt;
&lt;LI&gt;"BFL-*" &lt;/LI&gt;
&lt;LI&gt;"BCIMR-*"&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;The login is only in the request, and not in the response.&lt;BR /&gt;
I am trying to filter by putting the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;customergetservice host=MBKBKKSPHTRSP0* source="/var/log/jbossas/standalone/server.log" | transaction RequestId startswith="BCIMR-*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when I add the StartsWith, everything's broken, as the events are not linked together anymore.&lt;BR /&gt;
See following comment for example as I can't add more than 2 images per question&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 08:34:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465138#M131051</guid>
      <dc:creator>gmasy</dc:creator>
      <dc:date>2020-04-01T08:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465139#M131052</link>
      <description>&lt;P&gt;&lt;IMG src="https://i.imgur.com/NZwckDH.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;If someone has any input it'd be greatly appreciated. &lt;BR /&gt;
Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 08:36:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465139#M131052</guid>
      <dc:creator>gmasy</dc:creator>
      <dc:date>2020-04-01T08:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465140#M131053</link>
      <description>&lt;P&gt;try to add match/searchmatch to startswith:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;customergetservice host=MBKBKKSPHTRSP0* source="/var/log/jbossas/standalone/server.log" | transaction RequestId startswith=eval(searchmatch("BCIMR-"))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Apr 2020 12:01:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465140#M131053</guid>
      <dc:creator>PavelP</dc:creator>
      <dc:date>2020-04-01T12:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465141#M131054</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;customergetservice host=MBKBKKSPHTRSP0* source="/var/log/jbossas/standalone/server.log"  (login="BBC-*" OR login="BBF-*" OR login="BFL-*" OR login="BCIMR-*") OR "LEAN-RESPONSE"
| rex "(?&amp;lt;status&amp;gt;LEAN-(REQUEST|RESPONSE))"
| stats dc(status) as flag values(_raw) as _raw values(_time) as _time by RequestId
| where flag &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you don't need &lt;CODE&gt;transaction&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;transaction&lt;/CODE&gt; command consumes much search time.&lt;BR /&gt;
 &lt;CODE&gt;stats&lt;/CODE&gt; is almost useful and no problem.&lt;BR /&gt;
because &lt;CODE&gt;stats&lt;/CODE&gt; makes events to combine one event by same field value.&lt;BR /&gt;
Isn't it the same as the &lt;CODE&gt;transaction&lt;/CODE&gt; command?&lt;/P&gt;

&lt;P&gt;my previous answer has a few typo(&lt;EM&gt;statsu&lt;/EM&gt;). I fix it.&lt;/P&gt;

&lt;P&gt;Is there the &lt;CODE&gt;login&lt;/CODE&gt; field? please try again.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 12:43:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465141#M131054</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-01T12:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465142#M131055</link>
      <description>&lt;P&gt;Ditch &lt;CODE&gt;transaction&lt;/CODE&gt;; it is overkill and does not scale well; try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="YouShouldAlwaysSepcifyIndex" AND sourcetype="AndSourcetypeToo" AND "customergetservice" AND host="MBKBKKSPHTRSP0*" AND source="/var/log/jbossas/standalone/server.log"
| rex "LEAN-(?&amp;lt;status&amp;gt;REQUEST|RESPONSE)"
| reverse
| streamstats count(eval(searchmatch("BCIMR-*"))) AS TransactionID BY RequestId
| stats range(_time) AS duration count AS eventcount values(status) AS status dc(status) AS statuscount min(_time) AS _time BY TransactionID RequestId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Apr 2020 14:43:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465142#M131055</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-04-01T14:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465143#M131056</link>
      <description>&lt;P&gt;Thanks to the three of you for your quick input about my problem!&lt;BR /&gt;
I'm happily surprised of the reactivity on this forum, as this was my very first post...&lt;/P&gt;

&lt;P&gt;However, none of the solutions provided did work for me.&lt;BR /&gt;
@PavelP, although your solution seemed great, I got the same result as attached in previous screenshot. The response and request are not grouped in the same event when adding the &lt;CODE&gt;startswith&lt;/CODE&gt; ...&lt;/P&gt;

&lt;P&gt;@to4kawa and @woodcock , thank you for your suggestions, could you please explain me why &lt;CODE&gt;transaction&lt;/CODE&gt; is overkill for what I am trying to achieve?&lt;BR /&gt;
It's the only solution I have found in the Splunk documentation to match two corresponding events in the same splunk result.&lt;BR /&gt;
It enables me to see what is in each request and what is the associated response.&lt;BR /&gt;
&lt;CODE&gt;stats&lt;/CODE&gt; here is not the thing I am trying to achieve just yet.&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 17:51:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465143#M131056</guid>
      <dc:creator>gmasy</dc:creator>
      <dc:date>2020-04-01T17:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465144#M131057</link>
      <description>&lt;P&gt;I see. my answer is updated. please check and try.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 20:22:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465144#M131057</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-01T20:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465145#M131058</link>
      <description>&lt;P&gt;This one actually worked like a charm and is 10 times faster than the &lt;CODE&gt;transaction&lt;/CODE&gt; method!&lt;BR /&gt;
Thank you so much&lt;/P&gt;

&lt;P&gt;Is there a way to do a timechart of the duration between the request and its response with the solution you provided?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 02:35:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465145#M131058</guid>
      <dc:creator>gmasy</dc:creator>
      <dc:date>2020-04-02T02:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465146#M131059</link>
      <description>&lt;P&gt;&lt;CODE&gt;a timechart of the duration between the request and its response&lt;/CODE&gt;&lt;BR /&gt;
What's x-axis and y-axis?&lt;/P&gt;

&lt;P&gt;There is no keep-alive log. Your log has only &lt;EM&gt;REQUEST&lt;/EM&gt; and &lt;EM&gt;RESPONSE&lt;/EM&gt;.&lt;/P&gt;

&lt;P&gt;Everybody wants to make time chart. but It's very hard.&lt;BR /&gt;
Good luck.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 02:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465146#M131059</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-02T02:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465147#M131060</link>
      <description>&lt;P&gt;x-axis would be the time&lt;BR /&gt;
y-axis would be te average response time&lt;/P&gt;

&lt;P&gt;We like to monitor the response time over a period, to detect if a component is down.&lt;/P&gt;

&lt;P&gt;Please see example below of what I could achieve with &lt;CODE&gt;transaction&lt;/CODE&gt;. However this method is very long and usually times out if I check on a very long time span.&lt;BR /&gt;
&lt;IMG src="https://i.imgur.com/kIf3HSS.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 03:10:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465147#M131060</guid>
      <dc:creator>gmasy</dc:creator>
      <dc:date>2020-04-02T03:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: StartsWith breaks the transaction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465148#M131061</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; customergetservice host=MBKBKKSPHTRSP0* source="/var/log/jbossas/standalone/server.log"  (login="BBC-*" OR login="BBF-*" OR login="BFL-*" OR login="BCIMR-*") OR "LEAN-RESPONSE"
 | rex "(?&amp;lt;status&amp;gt;LEAN-(REQUEST|RESPONSE))"
 | stats dc(status) as flag min(_time) as _time range(_time) as duration by RequestId
 | where flag &amp;gt; 1
 | fields _time RequestId duration
 | timechart span=1h avg(duration)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want to calculate by each RequestId, use &lt;CODE&gt;by&lt;/CODE&gt; clause.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Apr 2020 04:15:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/StartsWith-breaks-the-transaction/m-p/465148#M131061</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-02T04:15:06Z</dc:date>
    </item>
  </channel>
</rss>

