<?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: Using mstats with eval grouped by field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510633#M142942</link>
    <description>&lt;P&gt;&lt;STRONG&gt;cpu_limit&lt;/STRONG&gt; is null. your &lt;STRONG&gt;eval &lt;/STRONG&gt;can't work.&lt;BR /&gt;is there&lt;STRONG&gt; kube.pod.cpu.limit &lt;/STRONG&gt;?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jul 2020 11:49:28 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-07-23T11:49:28Z</dc:date>
    <item>
      <title>Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510618#M142936</link>
      <description>&lt;P&gt;I wanted to graph the computed value of two fields and group the result by another field:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(kube.pod.cpu.limit) AS cpu_limit avg(kube.pod.cpu.usage_rate) AS cpu_usage WHERE index="metrics" span=auto BY "pod-name"
| eval utilization=((cpu_usage/cpu_limit) * 100)
| timechart values(utilization) agg=max limit=5 useother=false BY "pod-name"
| fields - _span*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I am not getting any result.&amp;nbsp; Here's the original search I used as starting point:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(_value) prestats=true WHERE metric_name="kube.container.cpu.usage" AND index="metrics" AND "pod-name"="router*" $mstats_span$ BY "pod-name"
| timechart avg(_value) $timechart_span$ agg=max limit=5 useother=false BY "pod-name"
| fields - _span*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 10:56:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510618#M142936</guid>
      <dc:creator>prandelicious</dc:creator>
      <dc:date>2020-07-23T10:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510621#M142938</link>
      <description>&lt;P&gt;... BY "pod-name" &lt;STRONG&gt;_time&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;how about adding _time?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 10:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510621#M142938</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-23T10:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510623#M142939</link>
      <description>&lt;P&gt;I modified the search&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(kube.pod.cpu.limit) AS cpu_limit avg(kube.pod.cpu.usage_rate) AS cpu_usage WHERE index="metrics" AND "pod-name"="router*" BY "pod-name" span=auto
| eval utilization=((cpu_usage/cpu_limit) * 100)
| timechart values(utilization) span=5m agg=max limit=5 useother=false BY "pod-name" _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I'm getting&lt;STRONG&gt;&amp;nbsp;Error in 'timechart' command: The argument '_time' is invalid.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 10:53:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510623#M142939</guid>
      <dc:creator>prandelicious</dc:creator>
      <dc:date>2020-07-23T10:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510626#M142940</link>
      <description>&lt;P&gt;I'm sorry , &lt;STRONG&gt;mstats&lt;/STRONG&gt; can't use &lt;EM&gt;_time&lt;/EM&gt; in &lt;STRONG&gt;by&lt;/STRONG&gt; clause.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(kube.pod.cpu.limit) AS cpu_limit avg(kube.pod.cpu.usage_rate) AS cpu_usage WHERE index="metrics" AND "pod-name"="router*" BY "pod-name" span=auto
| eval utilization=((cpu_usage/cpu_limit) * 100)&lt;/LI-CODE&gt;&lt;P&gt;what's this result? is there&amp;nbsp;&lt;EM&gt;utilization &lt;/EM&gt;field ?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 11:00:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510626#M142940</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-23T11:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510630#M142941</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;There's no &lt;EM&gt;utilization&lt;/EM&gt; field. Here's the output&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-07-23 at 7.27.32 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9843iADB38F09884C9DAE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-07-23 at 7.27.32 PM.png" alt="Screen Shot 2020-07-23 at 7.27.32 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 11:30:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510630#M142941</guid>
      <dc:creator>prandelicious</dc:creator>
      <dc:date>2020-07-23T11:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510633#M142942</link>
      <description>&lt;P&gt;&lt;STRONG&gt;cpu_limit&lt;/STRONG&gt; is null. your &lt;STRONG&gt;eval &lt;/STRONG&gt;can't work.&lt;BR /&gt;is there&lt;STRONG&gt; kube.pod.cpu.limit &lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 11:49:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510633#M142942</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-23T11:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510635#M142943</link>
      <description>&lt;P&gt;Yes, there is&amp;nbsp;&lt;STRONG&gt;kube.pod.cpu.limit &lt;/STRONG&gt;if I don't use &lt;STRONG&gt;BY pod-name&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| mstats avg(kube.pod.cpu.limit) AS "avg_cpu_limit" WHERE index="metrics" span=5m&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-07-23 at 7.56.50 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9844i8AAB571148FE1AB9/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-07-23 at 7.56.50 PM.png" alt="Screen Shot 2020-07-23 at 7.56.50 PM.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;but I get no result if use &lt;STRONG&gt;BY pod-name&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 12:01:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510635#M142943</guid>
      <dc:creator>prandelicious</dc:creator>
      <dc:date>2020-07-23T12:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510643#M142949</link>
      <description>&lt;LI-CODE lang="markup"&gt;| mstats avg(_value) prestats=true WHERE metric_name="kube.pod.cpu.usage_rate" AND index="metrics" AND "pod-name"="router*" span=auto BY "pod-name"
| timechart avg(_value) span=auto agg=max limit=5 useother=false BY "pod-name"
| fields - _span*
| untable _time pod_name usage_avg
| append [| mstats avg(_value) prestats=true WHERE metric_name="kube.container.cpu.limit" AND index="metrics" AND "pod-name"="router*" span=auto BY "pod-name"
| timechart avg(_value) $timechart_span$ agg=max limit=5 useother=false BY "pod-name"
| fields - _span*
| untable _time pod_name limit_avg]
| stats values(*_avg) as *_avg by _time pod_name &lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;For now, I've combined a working query.&lt;BR /&gt;how about this?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 12:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510643#M142949</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-23T12:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510763#M143017</link>
      <description>&lt;P&gt;Thanks for taking time to create the query! Here's the output when I tested it:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-07-24 at 10.21.25 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9855i7648EBCEC4B77277/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-07-24 at 10.21.25 AM.png" alt="Screen Shot 2020-07-24 at 10.21.25 AM.png" /&gt;&lt;/span&gt;what I wanted was to get the value of utilization, which is defined as ((kube.pod.cpu.usage_rate /&amp;nbsp;kube.container.cpu.limit) * 100) that's why I used &lt;STRONG&gt;eval&lt;/STRONG&gt; in my previous example.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 02:31:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510763#M143017</guid>
      <dc:creator>prandelicious</dc:creator>
      <dc:date>2020-07-24T02:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using mstats with eval grouped by field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510771#M143018</link>
      <description>&lt;P&gt;subsearch doesn't return values.&lt;/P&gt;&lt;P&gt;please do troubleshooting.&lt;/P&gt;&lt;P&gt;e.g.&amp;nbsp;subsearch only run, and fix&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jul 2020 03:41:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mstats-with-eval-grouped-by-field/m-p/510771#M143018</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-07-24T03:41:47Z</dc:date>
    </item>
  </channel>
</rss>

