<?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: help on eval in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394981#M6692</link>
    <description>&lt;P&gt;@jip31,&lt;/P&gt;

&lt;P&gt;Kindly Provide sample data as displayed by 493669.&lt;BR /&gt;
So someone can help you .. &lt;BR /&gt;
Without sample data and your expected result . how can someone help you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ..&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
    <pubDate>Fri, 10 Aug 2018 09:55:30 GMT</pubDate>
    <dc:creator>Shan</dc:creator>
    <dc:date>2018-08-10T09:55:30Z</dc:date>
    <item>
      <title>help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394973#M6684</link>
      <description>&lt;P&gt;hello&lt;BR /&gt;
In "eval TotalSpace" I need to multiply "Percfree_space" with "FreeSpace" and to add the FreeSpace total to the result and to display &lt;BR /&gt;
the result  of "FreeSpace" and "TotalSpace" in "eval Disk" &lt;BR /&gt;
I done this but it doesnt works&lt;BR /&gt;
Could you help me please??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval MBfree_space = if(counter="Free Megabytes",Value,null) 

| eval Percfree_space = if(counter="% Free Space",Value,null)  

| eval FreeSpace = round(MBfree_space/1024,2)." MB / "

| eval TotalSpace = round((100-Percfree_space)*(FreeSpace)+(FreeSpace),2))." MB"

| eval Disk = FreeSpace "/" TotalSpace
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 05:25:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394973#M6684</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-08-08T05:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394974#M6685</link>
      <description>&lt;P&gt;can you provide some sample having value of field names &lt;CODE&gt;counter&lt;/CODE&gt; ,&lt;CODE&gt;value&lt;/CODE&gt;, etc. and expected result &lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 05:32:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394974#M6685</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-08-08T05:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394975#M6686</link>
      <description>&lt;P&gt;I dont understand your questions&lt;BR /&gt;
Free Megabytes give the amount of free disk space in megabytes&lt;BR /&gt;
% Free Space give the amount of free disk space in %&lt;BR /&gt;
So in eval disk I need to display for example 300 MB / 400 MB&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 05:56:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394975#M6686</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-08-08T05:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394976#M6687</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval MBfree_space = if(counter="Free Megabytes",Value,null) 
 | eval Percfree_space = if(counter="% Free Space",Value,null)  
 | eval FreeSpace = round(MBfree_space/1024,2)
 |fillnull
 | eval TotalSpace = round(((100-Percfree_space)*FreeSpace)+FreeSpace,2)
 | eval Disk = FreeSpace."MB". "/". TotalSpace."MB"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 06:05:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394976#M6687</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-08-08T06:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394977#M6688</link>
      <description>&lt;P&gt;it doesnt works&lt;BR /&gt;
it calculate nothing because i have 0MB/0.00MB (also in other columns)&lt;BR /&gt;
when i delete |fillnull i have nothing&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 06:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394977#M6688</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-08-08T06:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394978#M6689</link>
      <description>&lt;P&gt;Hello @jip31,&lt;/P&gt;

&lt;P&gt;what are you trying to do with this line : &lt;CODE&gt;| eval Disk = FreeSpace "/" TotalSpace&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;It does not concatenate and does not perform an operation.&lt;/P&gt;

&lt;P&gt;Did you not mean &lt;CODE&gt;| eval Disk = FreeSpace ."/". TotalSpace&lt;/CODE&gt; ?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Aug 2018 06:31:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394978#M6689</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-08-08T06:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394979#M6690</link>
      <description>&lt;P&gt;thats why I asked to share sample values of fields like &lt;CODE&gt;counter&lt;/CODE&gt; &lt;CODE&gt;value&lt;/CODE&gt; and expected result of &lt;CODE&gt;TotalSpace&lt;/CODE&gt; &lt;CODE&gt;Disk&lt;/CODE&gt;&lt;BR /&gt;
like below-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;counter                  Value   FreeSpace     TotalSpace               Disk 
Free Megabytes          23          0.02               2.02              0.02MB/2.02MB
% Free Space               30          0                 0.00              0MB/0.00MB
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 06:32:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394979#M6690</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-08-08T06:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394980#M6691</link>
      <description>&lt;P&gt;Nobody for helping me please?&lt;BR /&gt;
with this i have no results&lt;BR /&gt;
    | eval MBfree_space = if(counter="Free Megabytes",Value,null) &lt;BR /&gt;
    | eval Percfree_space = if(counter="% Free Space",Value,null)&lt;BR /&gt;&lt;BR /&gt;
    | eval FreeSpace = round(MBfree_space/1024,2)&lt;BR /&gt;
    | eval TotalSpace = round(((100-Percfree_space)*FreeSpace)+FreeSpace,2)&lt;BR /&gt;
    | eval Disk = FreeSpace."MB". "/". TotalSpace."MB"&lt;BR /&gt;
    | stats latest(Disk) as Disk by host&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394980#M6691</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-29T20:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394981#M6692</link>
      <description>&lt;P&gt;@jip31,&lt;/P&gt;

&lt;P&gt;Kindly Provide sample data as displayed by 493669.&lt;BR /&gt;
So someone can help you .. &lt;BR /&gt;
Without sample data and your expected result . how can someone help you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ..&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 09:55:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394981#M6692</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-08-10T09:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394982#M6693</link>
      <description>&lt;P&gt;hello &lt;BR /&gt;
the entire &lt;BR /&gt;
index="perfmon" sourcetype="perfmon:logicaldisk" instance=c: counter="Free Megabytes" OR counter="% Free Space"| eval MBfree_space = if(counter="Free Megabytes",Value,null) &lt;BR /&gt;
| eval Percfree_space = if(counter="% Free Space",Value,null)&lt;BR /&gt;&lt;BR /&gt;
| eval FreeSpace = round(MBfree_space/1024,2)&lt;BR /&gt;
| eval TotalSpace = round(((100-Percfree_space)*FreeSpace)+FreeSpace,2)&lt;BR /&gt;
| eval Disk = FreeSpace."MB". "/". TotalSpace."MB"| stats latest(Disk) as Disk&lt;/P&gt;

&lt;P&gt;I need result with this format : 0.00MB/0.00MB &lt;BR /&gt;
First the free space in MB and after the toatl space in MB&lt;BR /&gt;
thanks a lot&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:53:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394982#M6693</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-29T20:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394983#M6694</link>
      <description>&lt;P&gt;The problem appears to be that you have two different kinds of records, each a different counter, and so one of the numbers on each record will always be null.   Multiplying anything times null will always be null.  if you use fillnull, you will multiply by zero and get zero.  &lt;/P&gt;

&lt;P&gt;I'm going to guess that these are Perfmon metric records on Windows.  I guessed that by doing a google search for the key words and field names you are looking for... &lt;CODE&gt;site:answers.splunk.com free megabytes counter value&lt;/CODE&gt;  If you just search for what you are trying to do, you will find multiple examples.  &lt;/P&gt;

&lt;P&gt;This one is somewhat similar to your issue, and has an excellent answer by @cusello, and other quick answers by @woodcock and @somesoni2, two of our heavy hitters.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/512937/how-to-combine-2-searches-to-get-show-values-and-p.html"&gt;https://answers.splunk.com/answers/512937/how-to-combine-2-searches-to-get-show-values-and-p.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Here's another... &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/454999/how-to-develop-a-search-to-find-free-disk-space-us.html"&gt;https://answers.splunk.com/answers/454999/how-to-develop-a-search-to-find-free-disk-space-us.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And here's one I just have to include because the accepted answer is code written by awesome Splunk guy @jkat54, and it is code which clearly embarrassed him to post, so I just have to call everybody's attention to it... &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/439855/how-to-calculate-total-disk-size-when-using-freedi.html"&gt;https://answers.splunk.com/answers/439855/how-to-calculate-total-disk-size-when-using-freedi.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;There's another version in a comment underneath his which refactors jkat's code from a join to stats, which is the preferred method, but if either one meets your use case, use it.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Aug 2018 05:09:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394983#M6694</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-08-11T05:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394984#M6695</link>
      <description>&lt;P&gt;It is likely that the problem is that each metric is in a different event.  If so, the separate events must be merged before the fields/values can be used together.  In any case, until you show us EXACTLY what each event is, it is unlikely that anyone will be able to help.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Aug 2018 05:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/help-on-eval/m-p/394984#M6695</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-08-11T05:41:28Z</dc:date>
    </item>
  </channel>
</rss>

