<?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 use eval to find percentage and combine with a stats search to set up an alert? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193864#M55873</link>
    <description>&lt;P&gt;I believe i'm a bit closer here &lt;/P&gt;

&lt;P&gt;index=licenselimit earliest=-48h@d | where LIC_SOFT_LIMIT != "" | table LIC_SOFT_LIMIT | append [search index=licenselimit sourcetype=MachineTotals earliest=-48h@d |stats sum(linecount) AS Number_Of_Encrypted_Machines] | eval percentage=(Number_Of_Encrypted_Machines/LIC_SOFT_LIMIT)*100&lt;/P&gt;

&lt;P&gt;When I run this command it just shows the two fields Number_Of_Encrypted_Machines and LIC_SOFT_LIMIT in a table. Can anyone else how I can make my eval work so I can divide Number Of Encrypted Machines by LIC_SFOT_LIMIT?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:04:51 GMT</pubDate>
    <dc:creator>akelly4</dc:creator>
    <dc:date>2020-09-28T18:04:51Z</dc:date>
    <item>
      <title>How to use eval to find percentage and combine with a stats search to set up an alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193863#M55872</link>
      <description>&lt;P&gt;I'm trying to setup an alert where if x/y &amp;lt;=x% then it sends an alert out.&lt;/P&gt;

&lt;P&gt;To do this i'm trying to pull numbers from two separate searches to divide them to get the percentage. But i'm having trouble figuring out what commands to use to do this.&lt;/P&gt;

&lt;P&gt;1st  search - This is the total number of machine that exist&lt;BR /&gt;
index=totalmachines sourcetype=Machines earliest=-48h@d |stats sum(linecount) AS Number_Of__Machines&lt;/P&gt;

&lt;P&gt;2nd search - This is the limit of machines we can reach. I want to use the EVAL command to be able to see when I come close to this limit.&lt;BR /&gt;
index=licenselimit sourcetype=LicenseLimitforMachines earliest=-48h@d | rename LIC_SOFT_LIMIT AS License_Limit | table License_Limit&lt;/P&gt;

&lt;P&gt;I have the numbers I just need to figure out how to combine those searches and run the eval command to get a percentage.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:04:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193863#M55872</guid>
      <dc:creator>akelly4</dc:creator>
      <dc:date>2020-09-28T18:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use eval to find percentage and combine with a stats search to set up an alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193864#M55873</link>
      <description>&lt;P&gt;I believe i'm a bit closer here &lt;/P&gt;

&lt;P&gt;index=licenselimit earliest=-48h@d | where LIC_SOFT_LIMIT != "" | table LIC_SOFT_LIMIT | append [search index=licenselimit sourcetype=MachineTotals earliest=-48h@d |stats sum(linecount) AS Number_Of_Encrypted_Machines] | eval percentage=(Number_Of_Encrypted_Machines/LIC_SOFT_LIMIT)*100&lt;/P&gt;

&lt;P&gt;When I run this command it just shows the two fields Number_Of_Encrypted_Machines and LIC_SOFT_LIMIT in a table. Can anyone else how I can make my eval work so I can divide Number Of Encrypted Machines by LIC_SFOT_LIMIT?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:04:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193864#M55873</guid>
      <dc:creator>akelly4</dc:creator>
      <dc:date>2020-09-28T18:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use eval to find percentage and combine with a stats search to set up an alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193865#M55874</link>
      <description>&lt;P&gt;If you're just getting one row from licenselimit search as well (you're getting one row from totalmachines  search) then try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=licenselimit sourcetype=LicenseLimitforMachines earliest=-48h@d | rename LIC_SOFT_LIMIT AS License_Limit | table License_Limit | appendcols [search index=totalmachines sourcetype=Machines earliest=-48h@d |stats sum(linecount) AS Number_Of__Machines] | eval percentage=(Number_Of_Encrypted_Machines/LIC_SOFT_LIMIT)*100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Nov 2014 21:41:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193865#M55874</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-11-04T21:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use eval to find percentage and combine with a stats search to set up an alert?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193866#M55875</link>
      <description>&lt;P&gt;I tried this but it still returns 2 rows with each of those fields. From what I can tell it's not doing that calculation.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 20:10:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-eval-to-find-percentage-and-combine-with-a-stats/m-p/193866#M55875</guid>
      <dc:creator>akelly4</dc:creator>
      <dc:date>2014-11-05T20:10:49Z</dc:date>
    </item>
  </channel>
</rss>

