<?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: mstats and eval - getting free memory in GB instead of bytes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/519285#M146224</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my late response.&lt;/P&gt;&lt;P&gt;I tried several scenario's, as well the one you suggested. In your first suggestion, using avg(_value) in the eval, it gives the error that avg is not supported in eval&lt;/P&gt;&lt;P&gt;The second suggestion also fails (with the as _value). It doesn't give an error, but the statistics are just empty without data of graph shown. (removing it, shows me the data again, so it must be incorrect).&lt;/P&gt;&lt;P&gt;The third solution is what I am doing now, but it will show in the graph something like 6.5b where b stands for billion and not bytes. Which is confusing, as the graph will say 'free memory in bytes' and one could mistakenly interpret is as 6.5 bytes...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I don't think this is a nice solution. You're still showing values in bytes and looks weird. I'd just want to convert it to a 1 or 2-decimal GB value and have the graph show 6.5Gb instead (Gigabytes)&lt;/P&gt;&lt;P&gt;Via the Analytics tab is a lot easier to work with the data and get it in the graph, but also that lacks the ability of calculations or rounding&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 13 Sep 2020 09:09:21 GMT</pubDate>
    <dc:creator>bloodseaker</dc:creator>
    <dc:date>2020-09-13T09:09:21Z</dc:date>
    <item>
      <title>mstats and eval - How to get free memory in GB instead of bytes?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/518698#M145949</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I have following query to show a graph of the free memory on the server. This working nicely.&lt;/P&gt;
&lt;P&gt;However, the numbers are in bytes, making it hard to understand. When doing this with a regular stats command, I could add eval to calculate this, but with mstats this fails&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Working query without conversion&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;| mstats avg(_value) prestats=t WHERE index=em_metrics AND metric_name="Memory.Available_Bytes" span=30s by metric_name&lt;BR /&gt;| timechart avg(_value) as "Avg" span=1m by metric_name&lt;/P&gt;
&lt;P&gt;&lt;U&gt;failing query with eval&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;| mstats avg(_value) prestats=t WHERE index=em_metrics AND metric_name="Memory.Available_Bytes" span=30s by metric_name | eval FreeMem = ((_value/1024)/1024)&lt;BR /&gt;| timechart avg(FreeMem) as "Avg" span=1m by metric_name&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas how this can be achieved, I can't seem to find an example for mstats for this, only questions with stats&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 16:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/518698#M145949</guid>
      <dc:creator>bloodseaker</dc:creator>
      <dc:date>2023-08-08T16:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: mstats and eval - getting free memory in GB instead of bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/518707#M145952</link>
      <description>&lt;P&gt;Wouldn't avg(_value) be in a field called avg(_value) so FreeMem=((avg(_value)/1024)/1024)? Or can you mstat avg(_value) as _value? Alternatively, can you switch on number abbreviations for the y-axis on the chart?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 14:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/518707#M145952</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-09-09T14:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: mstats and eval - getting free memory in GB instead of bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/519285#M146224</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my late response.&lt;/P&gt;&lt;P&gt;I tried several scenario's, as well the one you suggested. In your first suggestion, using avg(_value) in the eval, it gives the error that avg is not supported in eval&lt;/P&gt;&lt;P&gt;The second suggestion also fails (with the as _value). It doesn't give an error, but the statistics are just empty without data of graph shown. (removing it, shows me the data again, so it must be incorrect).&lt;/P&gt;&lt;P&gt;The third solution is what I am doing now, but it will show in the graph something like 6.5b where b stands for billion and not bytes. Which is confusing, as the graph will say 'free memory in bytes' and one could mistakenly interpret is as 6.5 bytes...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I don't think this is a nice solution. You're still showing values in bytes and looks weird. I'd just want to convert it to a 1 or 2-decimal GB value and have the graph show 6.5Gb instead (Gigabytes)&lt;/P&gt;&lt;P&gt;Via the Analytics tab is a lot easier to work with the data and get it in the graph, but also that lacks the ability of calculations or rounding&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Sep 2020 09:09:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/519285#M146224</guid>
      <dc:creator>bloodseaker</dc:creator>
      <dc:date>2020-09-13T09:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: mstats and eval - getting free memory in GB instead of bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/519288#M146226</link>
      <description>&lt;P&gt;Ok&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After playing around like hell... I got it to work.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(_value) as "Avg" WHERE host=VWININTAPI1D AND metric_name="Memory.Available_Bytes" span=5s
| eval mem_gb = Avg / 1024 / 1024 / 1024
| timechart max("mem_gb") AS "GB Free" span=5m&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 13 Sep 2020 09:31:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/519288#M146226</guid>
      <dc:creator>bloodseaker</dc:creator>
      <dc:date>2020-09-13T09:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: mstats and eval - getting free memory in GB instead of bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/570152#M198720</link>
      <description>&lt;P&gt;But you only ommit&amp;nbsp;&lt;SPAN&gt;by metric_name why about if we have for example various host...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 22:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/570152#M198720</guid>
      <dc:creator>Isa_O</dc:creator>
      <dc:date>2021-10-07T22:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: mstats and eval - getting free memory in GB instead of bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/653587#M225861</link>
      <description>&lt;P&gt;When I try the accepted solution I get the error:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;Cannot filter on 'metric_name' in normalized syntax.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's my query:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;| mstats avg(value) AS mem_b WHERE index="my-index" AND metric_name="jvm_memory_used" span=1m BY "app.name"&lt;BR /&gt;| eval mem_gb = mem_b / 1024 /1024 / 1024&lt;BR /&gt;| stats max(mem_gb) BY "app.name"&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Aug 2023 15:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mstats-and-eval-How-to-get-free-memory-in-GB-instead-of-bytes/m-p/653587#M225861</guid>
      <dc:creator>JoshMc</dc:creator>
      <dc:date>2023-08-08T15:34:06Z</dc:date>
    </item>
  </channel>
</rss>

