<?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 do I combine two fields from different sources but of the same source type in a single search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458597#M129479</link>
    <description>&lt;P&gt;To get the ratio between two maximums your search looks pretty much correct already, I'd just leave off the rounding until the very end.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=A OR source=B
| stats max(fieldA) as maxA max(fieldB) as maxB 
| eval percent_ratio = round(maxA/maxB*100, 2) 
| fields percent_ratio
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 15 Sep 2018 21:00:22 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2018-09-15T21:00:22Z</dc:date>
    <item>
      <title>How do I combine two fields from different sources but of the same source type in a single search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458594#M129476</link>
      <description>&lt;P&gt;I am trying to perform a ratio calculation on 2 fields (values)  coming from different sources but of the same source type,  Individually my searches work fine  and return the correct values. But, when I combine them together, I get really weird results. Many Thanks for your help !&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(sourcetype= "test" source=A host =192.168.1.1 fieldA=* ) OR source=B
eval sourceA=round(fieldA/1000),2
eval sourceB=round(fieldB/1000),2
stats max(sourceA) as SA max(sourceB) as SB
|eval percent_ratio=round(SA/SB,2)
|stats max(percent_ratio)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Legend:&lt;BR /&gt;
fieldA (sourceA), &lt;BR /&gt;
fieldB (sourceB)&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 15:50:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458594#M129476</guid>
      <dc:creator>rkatsnel</dc:creator>
      <dc:date>2018-09-15T15:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine two fields from different sources but of the same source type in a single search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458595#M129477</link>
      <description>&lt;P&gt;Can you describe what result you're looking for?&lt;/P&gt;

&lt;P&gt;As your search sits now, you're getting the maximums of both values, calculating the ratio of those two maximums, and then getting the maximum of that one ratio. I can't tell from that what you're actually trying to achieve, and in what way your search deviates from that goal.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 17:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458595#M129477</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-09-15T17:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine two fields from different sources but of the same source type in a single search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458596#M129478</link>
      <description>&lt;P&gt;Hello Martin , Thanks for your reply &lt;/P&gt;

&lt;P&gt;I am trying to calculate percent ratio  from   two max(values) belong to two diff sources and I am looking for the correct syntax on how to do that &lt;/P&gt;

&lt;P&gt;dataset from sourceA&lt;BR /&gt;
fieldA (value)&lt;BR /&gt;
no fieldB&lt;/P&gt;

&lt;P&gt;data set from sourceB&lt;BR /&gt;
fieldB(value)&lt;BR /&gt;
no fieldA&lt;BR /&gt;
it should produce the following  results&lt;/P&gt;

&lt;P&gt;sourceA(max value) sourceB(max value)  percent_ratio&lt;BR /&gt;
62                                200    (200/62)*100&lt;/P&gt;

&lt;P&gt;Hope it will clarified your question &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 17:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458596#M129478</guid>
      <dc:creator>rkatsnel</dc:creator>
      <dc:date>2018-09-15T17:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine two fields from different sources but of the same source type in a single search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458597#M129479</link>
      <description>&lt;P&gt;To get the ratio between two maximums your search looks pretty much correct already, I'd just leave off the rounding until the very end.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=A OR source=B
| stats max(fieldA) as maxA max(fieldB) as maxB 
| eval percent_ratio = round(maxA/maxB*100, 2) 
| fields percent_ratio
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 15 Sep 2018 21:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458597#M129479</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-09-15T21:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine two fields from different sources but of the same source type in a single search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458598#M129480</link>
      <description>&lt;P&gt;Appreciated , &lt;BR /&gt;
another question if you don't mind , what about &lt;BR /&gt;
sum &amp;amp; max it shouldn't make no difference , correct ? &lt;/P&gt;

&lt;P&gt;source=A OR source=B&lt;BR /&gt;
 | stats sum(fieldA) as sumA max(fieldB) as maxB &lt;BR /&gt;
 | eval percent_ratio = round(sumA/maxB*100, 2) &lt;BR /&gt;
 | fields percent_ratio&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:15:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458598#M129480</guid>
      <dc:creator>rkatsnel</dc:creator>
      <dc:date>2020-09-29T21:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine two fields from different sources but of the same source type in a single search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458599#M129481</link>
      <description>&lt;P&gt;If that's the calculation you need, sure.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 22:12:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458599#M129481</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-09-15T22:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I combine two fields from different sources but of the same source type in a single search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458600#M129482</link>
      <description>&lt;P&gt;Thanks Martin , Appreciate it !&lt;/P&gt;</description>
      <pubDate>Sat, 15 Sep 2018 23:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-combine-two-fields-from-different-sources-but-of-the/m-p/458600#M129482</guid>
      <dc:creator>rkatsnel</dc:creator>
      <dc:date>2018-09-15T23:05:59Z</dc:date>
    </item>
  </channel>
</rss>

