<?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: Arithmetic operation on fields from different events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514532#M144417</link>
    <description>&lt;P&gt;I didn't get the results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;Index Search&amp;gt;|&amp;nbsp;&lt;/P&gt;&lt;P&gt;in verbose mode returns&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. OS=Win Category=purchased Numbers=100&lt;/P&gt;&lt;P&gt;2. OS=Unix Category=purchased Numbers= 200&lt;/P&gt;&lt;P&gt;3. OS=Win Category=sold Number=50&lt;/P&gt;&lt;P&gt;4. OS=Unix Category=sold Number=125&lt;/P&gt;&lt;P&gt;My search scenario is, if OS is Windows, I want to calculate the remaining count which is purchased - sold. How to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Aug 2020 19:49:02 GMT</pubDate>
    <dc:creator>sstanlee</dc:creator>
    <dc:date>2020-08-17T19:49:02Z</dc:date>
    <item>
      <title>Arithmetic operation on fields from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514502#M144402</link>
      <description>&lt;P&gt;Consider the below types of events&lt;/P&gt;&lt;P&gt;fields&amp;nbsp; :&amp;nbsp; &amp;nbsp; &amp;nbsp;OS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;transaction&amp;nbsp; &amp;nbsp; &amp;nbsp; numbers&lt;/P&gt;&lt;P&gt;Events:&amp;nbsp; &amp;nbsp; &amp;nbsp;Win&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; purchased&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;150&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Unix&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;purchased&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Win&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sold&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Unix&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sold&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;125&lt;/P&gt;&lt;P&gt;I want the results to be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OS&amp;nbsp; &amp;nbsp; &amp;nbsp; InHand(purchased-sold)&lt;/P&gt;&lt;P&gt;Win&amp;nbsp; &amp;nbsp; &amp;nbsp; 50&lt;/P&gt;&lt;P&gt;Unix&amp;nbsp; &amp;nbsp; &amp;nbsp;75&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to do this?&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 17:13:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514502#M144402</guid>
      <dc:creator>sstanlee</dc:creator>
      <dc:date>2020-08-17T17:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arithmetic operation on fields from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514518#M144408</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="OS,transaction,numbers
Win,purchased,150
Unix,purchased,200
Win,sold,100
Unix,sold,125"
| multikv forceheader=1
| xyseries OS transaction numbers
| eval InHand=purchased-sold
| table OS InHand&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;upvote if my answer solves your problem.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 19:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514518#M144408</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-17T19:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arithmetic operation on fields from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514532#M144417</link>
      <description>&lt;P&gt;I didn't get the results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;Index Search&amp;gt;|&amp;nbsp;&lt;/P&gt;&lt;P&gt;in verbose mode returns&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. OS=Win Category=purchased Numbers=100&lt;/P&gt;&lt;P&gt;2. OS=Unix Category=purchased Numbers= 200&lt;/P&gt;&lt;P&gt;3. OS=Win Category=sold Number=50&lt;/P&gt;&lt;P&gt;4. OS=Unix Category=sold Number=125&lt;/P&gt;&lt;P&gt;My search scenario is, if OS is Windows, I want to calculate the remaining count which is purchased - sold. How to do this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 19:49:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514532#M144417</guid>
      <dc:creator>sstanlee</dc:creator>
      <dc:date>2020-08-17T19:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arithmetic operation on fields from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514534#M144419</link>
      <description>&lt;P&gt;I have shared query for the values you posted. I tried before posting and its working&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 20:02:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514534#M144419</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-08-17T20:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Arithmetic operation on fields from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514554#M144423</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=_internal | head 1
| fields _raw _time
| eval _raw="1. OS=Win Category=purchased Numbers=100
2. OS=Unix Category=purchased Numbers=200
3. OS=Win Category=sold Number=50
4. OS=Unix Category=sold Number=125"
| multikv noheader=t
| fields _raw _time
| kv
| rename COMMENT as "this is your sample"

| eval Numbers=coalesce(Numbers,-1 * Number)
| stats sum(Numbers) as "InHand(purchased-sold)" by OS&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 17 Aug 2020 21:47:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514554#M144423</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-08-17T21:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arithmetic operation on fields from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514736#M144486</link>
      <description>&lt;P&gt;I had more than 100 lines of data, but I quoted few as example.Initially it didnt work. I modified few of your code and it worked.&amp;nbsp; Thanks a lot.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 16:30:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514736#M144486</guid>
      <dc:creator>sstanlee</dc:creator>
      <dc:date>2020-08-18T16:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Arithmetic operation on fields from different events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514737#M144487</link>
      <description>&lt;P&gt;It worked. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 16:31:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Arithmetic-operation-on-fields-from-different-events/m-p/514737#M144487</guid>
      <dc:creator>sstanlee</dc:creator>
      <dc:date>2020-08-18T16:31:35Z</dc:date>
    </item>
  </channel>
</rss>

