<?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: eval streamstats result within timechart can't recognize field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-streamstats-result-within-timechart-can-t-recognize-field/m-p/49736#M11946</link>
    <description>&lt;P&gt;Have you tried something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timechart avg(last(Comp1)) AS myAvg | eval toPrint=round(myAvg,1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On my end, it added an extra column to the timechart for "toPrint" and had each value rounded to 1 decimal place. However, the "myAvg" column will still be displayed in the chart, and I'm not sure if this is exactly what you're after. If you want to remove the "myAvg" column, you can just add&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fields toPrint
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to the end of the query.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2011 16:13:07 GMT</pubDate>
    <dc:creator>acdevlin</dc:creator>
    <dc:date>2011-07-29T16:13:07Z</dc:date>
    <item>
      <title>eval streamstats result within timechart can't recognize field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-streamstats-result-within-timechart-can-t-recognize-field/m-p/49735#M11945</link>
      <description>&lt;P&gt;When I use streamstats to generate last values in the stream I can timechart the results appropriately (without error and with correct results) using &lt;CODE&gt;timechart avg(last(Comp1))&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;But, if I want to round the results in the timechart command, the eval fails to locate the field properly: &lt;CODE&gt;timechart eval(round(avg(last(Comp1)),1))&lt;/CODE&gt;  which results in &lt;CODE&gt;Error in 'timechart' command: The eval expression has no fields: 'round(avg(last(Comp1)),1)'&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2011 23:13:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-streamstats-result-within-timechart-can-t-recognize-field/m-p/49735#M11945</guid>
      <dc:creator>keycoldstorage</dc:creator>
      <dc:date>2011-07-27T23:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: eval streamstats result within timechart can't recognize field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-streamstats-result-within-timechart-can-t-recognize-field/m-p/49736#M11946</link>
      <description>&lt;P&gt;Have you tried something like this?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;timechart avg(last(Comp1)) AS myAvg | eval toPrint=round(myAvg,1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On my end, it added an extra column to the timechart for "toPrint" and had each value rounded to 1 decimal place. However, the "myAvg" column will still be displayed in the chart, and I'm not sure if this is exactly what you're after. If you want to remove the "myAvg" column, you can just add&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fields toPrint
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to the end of the query.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2011 16:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-streamstats-result-within-timechart-can-t-recognize-field/m-p/49736#M11946</guid>
      <dc:creator>acdevlin</dc:creator>
      <dc:date>2011-07-29T16:13:07Z</dc:date>
    </item>
  </channel>
</rss>

