<?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 Subtracting two fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694305#M236166</link>
    <description>&lt;P&gt;I extracted 2 fields called 'Resp_time' and 'Req_time'...Both these fields are integers.&lt;BR /&gt;I also changed the values to epoch&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I display the difference between the Resp_time and req_time?&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jul 2024 16:09:55 GMT</pubDate>
    <dc:creator>sintjm</dc:creator>
    <dc:date>2024-07-25T16:09:55Z</dc:date>
    <item>
      <title>Subtracting two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694305#M236166</link>
      <description>&lt;P&gt;I extracted 2 fields called 'Resp_time' and 'Req_time'...Both these fields are integers.&lt;BR /&gt;I also changed the values to epoch&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I display the difference between the Resp_time and req_time?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 16:09:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694305#M236166</guid>
      <dc:creator>sintjm</dc:creator>
      <dc:date>2024-07-25T16:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracting two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694313#M236170</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/267615"&gt;@sintjm&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;if they are integers or they are in epochtime, you can calculate the difference using eval command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
 | eval diff=Resp_time-Req_time&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 16:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694313#M236170</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-07-25T16:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracting two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694314#M236171</link>
      <description>&lt;P&gt;Hi thanks but the problem is they are not from the same events as they are separate&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sintjm_0-1721925754156.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/31893iE64FBA477D57EF0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sintjm_0-1721925754156.png" alt="sintjm_0-1721925754156.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 16:42:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694314#M236171</guid>
      <dc:creator>sintjm</dc:creator>
      <dc:date>2024-07-25T16:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracting two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694325#M236178</link>
      <description>&lt;P&gt;You will need a common value in the two types of events to correlate events. &amp;nbsp;For example, if each pair has a unique transaction ID, you can do&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(Resp_time) as Resp_time values(Req_time) as Req_time by transaction_id
| eval Resp_time - Req_time&lt;/LI-CODE&gt;&lt;P&gt;Alternatively, if you have some other ways to determine a pairing, e.g., the two always happen within a deterministic interval, &amp;nbsp;e.g., request comes in at 5 minute into the hour, a unique response is sent within the hour and NO other request would come in during the same hour, you can use that as criterion. &amp;nbsp;There may be other conditions where you would use transaction. &amp;nbsp;Unless you give us the exact condition, mathematically there is no solution.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 18:24:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694325#M236178</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-07-25T18:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracting two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694367#M236188</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/267615"&gt;@sintjm&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;as also&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;said, you need a correlation key to correlate the events, if you have, you can use it in a stats command and this is the best solution:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| stats 
    values(Resp_time) AS Resp_time 
    values(Req_time) AS Req_time 
    BY key
| eval diff=Resp_time-Req_time&lt;/LI-CODE&gt;&lt;P&gt;If you haven't and you're sure that events are always sequential, you could use the transaction command:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| transaction maxevents=2
| table duration&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 06:22:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694367#M236188</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2024-07-26T06:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracting two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694380#M236191</link>
      <description>&lt;P&gt;thanks, I used a c&lt;SPAN&gt;orrelation key to correlate the events and it worked.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 09:40:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694380#M236191</guid>
      <dc:creator>sintjm</dc:creator>
      <dc:date>2024-07-26T09:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Subtracting two fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694381#M236192</link>
      <description>&lt;P&gt;Helped a lot, thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2024 09:40:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Subtracting-two-fields/m-p/694381#M236192</guid>
      <dc:creator>sintjm</dc:creator>
      <dc:date>2024-07-26T09:40:58Z</dc:date>
    </item>
  </channel>
</rss>

