<?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 difference of two values of same field inside a transcation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/difference-of-two-values-of-same-field-inside-a-transcation/m-p/75330#M181339</link>
    <description>&lt;P&gt;Hi ALL,&lt;/P&gt;

&lt;P&gt;I am using a transaction command to group two events together,  "connect" and  "disconnect". Both the events have a common field called bytes and I need to get the difference of the bytes delivered during the disconnect event and connect event. &lt;/P&gt;

&lt;P&gt;How can I achieve this ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="access" event="*connect" status="200") | transaction c_ip eventttype startswith="connect" endswith="disconnect"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in Advance &lt;/P&gt;

&lt;P&gt;Aappreciate your help.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Feb 2012 05:01:49 GMT</pubDate>
    <dc:creator>KarunK</dc:creator>
    <dc:date>2012-02-21T05:01:49Z</dc:date>
    <item>
      <title>difference of two values of same field inside a transcation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/difference-of-two-values-of-same-field-inside-a-transcation/m-p/75330#M181339</link>
      <description>&lt;P&gt;Hi ALL,&lt;/P&gt;

&lt;P&gt;I am using a transaction command to group two events together,  "connect" and  "disconnect". Both the events have a common field called bytes and I need to get the difference of the bytes delivered during the disconnect event and connect event. &lt;/P&gt;

&lt;P&gt;How can I achieve this ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype="access" event="*connect" status="200") | transaction c_ip eventttype startswith="connect" endswith="disconnect"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in Advance &lt;/P&gt;

&lt;P&gt;Aappreciate your help.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Feb 2012 05:01:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/difference-of-two-values-of-same-field-inside-a-transcation/m-p/75330#M181339</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2012-02-21T05:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: difference of two values of same field inside a transcation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/difference-of-two-values-of-same-field-inside-a-transcation/m-p/75331#M181340</link>
      <description>&lt;P&gt;Use &lt;CODE&gt;mvlist=t&lt;/CODE&gt; as a parameter to &lt;CODE&gt;transaction&lt;/CODE&gt; to make sure you're getting field values in the correct (chronological) order, then use &lt;CODE&gt;mvindex&lt;/CODE&gt; to get the first and last value for &lt;CODE&gt;bytes&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | transaction mvlist=t c_ip eventtype startswith="connect" endswith="disconnect" | eval bytesdiff=tonumber(mvindex(bytes,-1))-tonumber(mvindex(bytes,0))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Feb 2012 08:11:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/difference-of-two-values-of-same-field-inside-a-transcation/m-p/75331#M181340</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-02-21T08:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: difference of two values of same field inside a transcation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/difference-of-two-values-of-same-field-inside-a-transcation/m-p/75332#M181341</link>
      <description>&lt;P&gt;Thanks Ayn. It worked....&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2012 05:42:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/difference-of-two-values-of-same-field-inside-a-transcation/m-p/75332#M181341</guid>
      <dc:creator>KarunK</dc:creator>
      <dc:date>2012-02-22T05:42:04Z</dc:date>
    </item>
  </channel>
</rss>

