<?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: Find percentage between two fields whose name will fall into a naming convention in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-percentage-between-two-fields-whose-name-will-fall-into-a/m-p/362136#M106972</link>
    <description>&lt;P&gt;You'd probably use foreach command here. Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search which includes fields resource_listed_* andn resource_available_*
| foreach resource_listed_* [eval "percent_consumed_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"='resource_listed_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;'*'resources_available_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;'/100]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;&lt;/CODE&gt; and single quotes are to be used exactly as specified above (literal string).&lt;/P&gt;</description>
    <pubDate>Fri, 16 Mar 2018 20:17:54 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-03-16T20:17:54Z</dc:date>
    <item>
      <title>Find percentage between two fields whose name will fall into a naming convention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-percentage-between-two-fields-whose-name-will-fall-into-a/m-p/362135#M106971</link>
      <description>&lt;P&gt;I have a set of fixed fields that define a maximum threshold with the naming convention of "resources_available_[[convention]]" &lt;/P&gt;

&lt;P&gt;and I have a variable set of fields which define a process consumption that will reference the naming convention like "resources_listed_[[convention]]"&lt;/P&gt;

&lt;P&gt;The convention portion of the field names matches, but while one is fixed, the other will be based on whatever work is going on at the time.  I'm trying to figure out how to calculate an evaluated percentage in time per convention (resources_listed_[[convention]])*(resources_available_[[convention]])/100 and the SPL to do this is just not coming to me...&lt;/P&gt;

&lt;P&gt;Scenario example is I can get 30 events in, each with different values:&lt;BR /&gt;
_time=now&lt;/P&gt;

&lt;P&gt;resource_listed_a=23&lt;/P&gt;

&lt;H2&gt;resource_listed_b=9839&lt;/H2&gt;

&lt;P&gt;resource_listed_a=102&lt;/P&gt;

&lt;H2&gt;resource_listed_b=1&lt;/H2&gt;

&lt;P&gt;resource_listed_cde=1200&lt;/P&gt;

&lt;H2&gt;While I have a static condition of &lt;/H2&gt;

&lt;P&gt;resources_available_a=9201&lt;BR /&gt;
resources_available_b=50&lt;BR /&gt;
resources_available_cde=1&lt;/P&gt;

&lt;P&gt;I want based on the event indexed:  eval percent_consumed_[[convention]]=resource_listed_[[convention]]*resources_available_[[convention]]/100&lt;/P&gt;

&lt;P&gt;Is this even possible?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:33:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-percentage-between-two-fields-whose-name-will-fall-into-a/m-p/362135#M106971</guid>
      <dc:creator>mjones414</dc:creator>
      <dc:date>2020-09-29T18:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: Find percentage between two fields whose name will fall into a naming convention</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-percentage-between-two-fields-whose-name-will-fall-into-a/m-p/362136#M106972</link>
      <description>&lt;P&gt;You'd probably use foreach command here. Try like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search which includes fields resource_listed_* andn resource_available_*
| foreach resource_listed_* [eval "percent_consumed_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"='resource_listed_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;'*'resources_available_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;'/100]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The &lt;CODE&gt;&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;&lt;/CODE&gt; and single quotes are to be used exactly as specified above (literal string).&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 20:17:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-percentage-between-two-fields-whose-name-will-fall-into-a/m-p/362136#M106972</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-03-16T20:17:54Z</dc:date>
    </item>
  </channel>
</rss>

