<?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: How to substract values from two different fields in a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222757#M65507</link>
    <description>&lt;P&gt;Is it possible that there is a single event which contain two fields, each with multiple values? In this scenario, the fields are the equivalent of arrays which hold a list of values and lists cannot be added together. Simply put: the operation needs to use a single value against a single value at a time.&lt;/P&gt;

&lt;P&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/2130i65A4E7F6757789F9/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;Do you notice the &lt;CODE&gt;eval&lt;/CODE&gt; statement at the end of the search?&lt;/P&gt;

&lt;P&gt;If this were the case, it will be necessary to break down the multi-value fields using some transformation commands. For the example above, the following works.&lt;/P&gt;

&lt;P&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/2131iED516E83AA2B9987/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;As other Splunkers point out above, it will be important to understand how the data is being presented. From there, the transformation can happen in number of ways. This is just an example based on intuituion... but it may not reflect your reality.&lt;/P&gt;

&lt;P&gt;I hope this helps,&lt;/P&gt;

&lt;P&gt;-gc&lt;/P&gt;</description>
    <pubDate>Tue, 08 Nov 2016 05:56:43 GMT</pubDate>
    <dc:creator>Gilberto_Castil</dc:creator>
    <dc:date>2016-11-08T05:56:43Z</dc:date>
    <item>
      <title>How to substract values from two different fields in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222753#M65503</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;

&lt;P&gt;I have a &lt;CODE&gt;FIELDX&lt;/CODE&gt; with values like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;VALUE1 200
VALUE2 120
VALUE3 156
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, I have another field &lt;CODE&gt;FIELDY&lt;/CODE&gt;, values:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;VALUE1 120
VALUE2 76
VALUE3 54
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to show in a table a new field showing the difference between &lt;CODE&gt;FIELDX&lt;/CODE&gt; and &lt;CODE&gt;FIELDY&lt;/CODE&gt; per VALUE. I mean:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FIELDZ

VALUE1 80
VALUE2 44
VALUE3 102
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried with a simple &lt;CODE&gt;... | eval FIELDZ=FIELDX-FIELDY&lt;/CODE&gt;, but that didn't work.&lt;/P&gt;

&lt;P&gt;How I can do this?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 02:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222753#M65503</guid>
      <dc:creator>changux</dc:creator>
      <dc:date>2016-11-08T02:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to substract values from two different fields in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222754#M65504</link>
      <description>&lt;P&gt;What is the format of the event? JSON? Posting the event might be helpful!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 03:57:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222754#M65504</guid>
      <dc:creator>jagadeeshm</dc:creator>
      <dc:date>2016-11-08T03:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to substract values from two different fields in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222755#M65505</link>
      <description>&lt;P&gt;Ive never done it, but you may try &lt;BR /&gt;
|eval fieldx=(fieldX - fieldy)&lt;BR /&gt;
I know you tried something similar, but I recall that functions usually need to be enclosed to work.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 05:10:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222755#M65505</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2016-11-08T05:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to substract values from two different fields in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222756#M65506</link>
      <description>&lt;P&gt;Ideally based on the example the above should work. Have you tried printing table FIELDX FIELDY FIELDZ? Are the two fields FIELDX &amp;amp; FIELDY numeric?&lt;BR /&gt;
Please provide Splunk search query and sample FIELDX and FIELDY.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 05:18:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222756#M65506</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-11-08T05:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to substract values from two different fields in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222757#M65507</link>
      <description>&lt;P&gt;Is it possible that there is a single event which contain two fields, each with multiple values? In this scenario, the fields are the equivalent of arrays which hold a list of values and lists cannot be added together. Simply put: the operation needs to use a single value against a single value at a time.&lt;/P&gt;

&lt;P&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/2130i65A4E7F6757789F9/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;Do you notice the &lt;CODE&gt;eval&lt;/CODE&gt; statement at the end of the search?&lt;/P&gt;

&lt;P&gt;If this were the case, it will be necessary to break down the multi-value fields using some transformation commands. For the example above, the following works.&lt;/P&gt;

&lt;P&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/2131iED516E83AA2B9987/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;As other Splunkers point out above, it will be important to understand how the data is being presented. From there, the transformation can happen in number of ways. This is just an example based on intuituion... but it may not reflect your reality.&lt;/P&gt;

&lt;P&gt;I hope this helps,&lt;/P&gt;

&lt;P&gt;-gc&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 05:56:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-substract-values-from-two-different-fields-in-a-search/m-p/222757#M65507</guid>
      <dc:creator>Gilberto_Castil</dc:creator>
      <dc:date>2016-11-08T05:56:43Z</dc:date>
    </item>
  </channel>
</rss>

