<?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 field which returns any results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474293#M145875</link>
    <description>&lt;P&gt;sorry i send it in 2 minutes&lt;/P&gt;</description>
    <pubDate>Thu, 20 Feb 2020 08:10:25 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2020-02-20T08:10:25Z</dc:date>
    <item>
      <title>help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474280#M145862</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8413i03D8672AA5BA78D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;A href="https://answers.splunk.comstorage/temp/283678-value.txt" target="_blank" rel="noopener"&gt;link text&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hi&lt;/P&gt;
&lt;P&gt;I have an issue with the field MemoryUsage&lt;BR /&gt;I have no results in &lt;CODE&gt;| eval MemoryUsage = round((TotalMemory-FreeMemory) / TotalMemory*100, 2)&lt;/CODE&gt; due to the field FreeMemory which returns any results&lt;BR /&gt;Its strange because the "Value" fields is an positive and integer number and I collect well this field&lt;BR /&gt;So what is the issue please&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;| fields host Value TotalPhysicalMemory 
| eval FreeMemory = round(Value, 0)
| eval TotalMemory = round((TotalPhysicalMemory / 1024 / 1024), 0) 
| eval MemoryUsage = round((TotalMemory-FreeMemory) / TotalMemory*100, 2) 
| stats last(FreeMemory) as "Free Memory", last(TotalMemory) as "Total Memory", values(MemoryUsage) as "Memory Usage" by host 
| eval Free Memory='Free Memory'." MB", Total Memory='Total Memory'." MB", Memory Usage='Memory Usage'." %"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Sep 2020 16:43:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474280#M145862</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-09-01T16:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474281#M145863</link>
      <description>&lt;P&gt;If the field MemoryUsage is empty, it is probably because the TotalMemory is 0 (due to rounding) and you cannot divide by 0.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 12:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474281#M145863</guid>
      <dc:creator>FreekMulders</dc:creator>
      <dc:date>2020-02-19T12:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474282#M145864</link>
      <description>&lt;P&gt;Can you provide an example of what value contains?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 14:10:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474282#M145864</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-19T14:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474283#M145865</link>
      <description>&lt;P&gt;I have attached an example of value field&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 14:30:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474283#M145865</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-19T14:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474284#M145866</link>
      <description>&lt;P&gt;Silly question - does your physical memory (or the value reported) always exceed the free memory?&lt;BR /&gt;
This strikes me that it can only be a maths problem.&lt;/P&gt;

&lt;P&gt;Your formula is converting TotalPhysicalMemory from bytes -&amp;gt; kilobytes -&amp;gt; megabytes, but there is no conversion for FreeMemory, is that always represented in megabytes?&lt;/P&gt;

&lt;P&gt;Can you run:&lt;BR /&gt;
&lt;CODE&gt;&amp;lt;your base search&amp;gt;|table Value TotalPhysicalMemory FreeMemory TotalMemory MemoryUsage&lt;/CODE&gt;&lt;BR /&gt;
So we can see the numbers that are being fed into the calculation.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 14:41:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474284#M145866</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-19T14:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474285#M145867</link>
      <description>&lt;P&gt;normally PhysicalMemory (memory installed) always exceed free memory&lt;BR /&gt;
yes by defaumt free memory is in megabytes&lt;BR /&gt;
I have executed the search I have results except in MemoryUsage&lt;BR /&gt;
if I replace FreeMemory by an integer  in &lt;CODE&gt;| eval MemoryUsage = round((TotalMemory-FreeMemory) / TotalMemory*100, 2)&lt;/CODE&gt; it works&lt;BR /&gt;
so the problem is arround FreeMemory&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 15:34:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474285#M145867</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-19T15:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474286#M145868</link>
      <description>&lt;P&gt;Can you just post the output of this:&lt;BR /&gt;
&lt;CODE&gt;&amp;lt;your base search&amp;gt;|table Value TotalPhysicalMemory FreeMemory TotalMemory MemoryUsage&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;There is something wrong with your data, and the results of that output will help highlight what the problem is.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 15:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474286#M145868</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-19T15:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474287#M145869</link>
      <description>&lt;P&gt;or value is empty in the event. &lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 15:46:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474287#M145869</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-19T15:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474288#M145870</link>
      <description>&lt;P&gt;I have attached the output&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 16:02:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474288#M145870</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-19T16:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474289#M145871</link>
      <description>&lt;P&gt;no, TotalMemory is never equal to 0........&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 05:56:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474289#M145871</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-20T05:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474290#M145872</link>
      <description>&lt;P&gt;Thanks for the output, but that does not help. &lt;BR /&gt;
Please can you post the output of this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| fields host Value TotalPhysicalMemory 
| eval FreeMemory = round(Value, 0)
| eval TotalMemory = round((TotalPhysicalMemory / 1024 / 1024), 0) 
| eval MemoryUsage = round((TotalMemory-FreeMemory) / TotalMemory*100, 2) 
|table Value TotalPhysicalMemory FreeMemory TotalMemory MemoryUsage 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My expectation is that there will be some rows with values missing/invalid&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 07:02:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474290#M145872</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-20T07:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474291#M145873</link>
      <description>&lt;P&gt;hum...&lt;BR /&gt;
its the same output like yesterday no??&lt;BR /&gt;
To my mind, i think that Value or TotalPhysicalMemory is not interpreted as a number&lt;BR /&gt;
What do you think about this? I tried with a tonumber function but always ko!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 07:58:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474291#M145873</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-20T07:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474292#M145874</link>
      <description>&lt;P&gt;no, its different - we dont want the stats commands in the output.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 08:01:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474292#M145874</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-20T08:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474293#M145875</link>
      <description>&lt;P&gt;sorry i send it in 2 minutes&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 08:10:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474293#M145875</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-20T08:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474294#M145876</link>
      <description>&lt;P&gt;&lt;A href="https://www.cjoint.com/c/JBuitvtTFoD"&gt;https://www.cjoint.com/c/JBuitvtTFoD&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 08:21:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474294#M145876</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-20T08:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474295#M145877</link>
      <description>&lt;P&gt;look between Value &lt;CODE&gt;3149&lt;/CODE&gt; and &lt;CODE&gt;2218&lt;/CODE&gt;&lt;BR /&gt;
there is null field.&lt;BR /&gt;
why?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 09:21:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474295#M145877</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-20T09:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474296#M145878</link>
      <description>&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/8412i1190F56D25BA7120/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 suspected, your events are riddled with null values - you are getting the physical memory and FreeMemory (Value) from different events.&lt;/P&gt;

&lt;P&gt;Try this (i have made some assumptions about host and _time) but see how this looks&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | fields _time host Value TotalPhysicalMemory 
 | bin span=5m _time
 | stats latest(Value) as FreeMemory latest(TotalPhysicalMemory) as TotalPhysicalMemory by host,_time
 | eval TotalMemory = round((TotalPhysicalMemory / 1024 / 1024), 0) 
 | eval MemoryUsage = round((TotalMemory-FreeMemory) / TotalMemory*100, 2) 
 | eval Free Memory='Free Memory'." MB", Total Memory='Total Memory'." MB", Memory Usage='Memory Usage'." %"
 |table _time host TotalMemory FreeMemory MemoryUsage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Feb 2020 09:46:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474296#M145878</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-20T09:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474297#M145879</link>
      <description>&lt;P&gt;Ok but I dont use | table in my search but stats by host&lt;BR /&gt;
 what I dont understand is that when i am doing a stats by host I have a value for all fields except MemoryUsage&lt;BR /&gt;
So why I cant calculate this field??&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 09:46:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474297#M145879</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-20T09:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474298#M145880</link>
      <description>&lt;P&gt;Because you are doing the stats (which merges the events) after the calculations have failed. My above example moves the stats before the calculations.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 09:46:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474298#M145880</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-02-20T09:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval field which returns any results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474299#M145881</link>
      <description>&lt;P&gt;thanks for your precious support!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 10:29:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval-field-which-returns-any-results/m-p/474299#M145881</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2020-02-20T10:29:46Z</dc:date>
    </item>
  </channel>
</rss>

