<?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: Timechart with latest() doesn't display results when used on its own in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224954#M66303</link>
    <description>&lt;P&gt;Aha! Yes, you're definitely on the right track. I didn't consider that UsePct actually is a string with a %-sign at the end. When I check under the statistics-tab, I can see that latest(UsePct) on its own shows the values with a %-sign. If I also include max(UsePct), the sign is dropped from both values. Odd behaviour, perhaps, but whether it's a bug might be debatable.&lt;BR /&gt;
Your solutions is probably the simplest. Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2016 07:45:03 GMT</pubDate>
    <dc:creator>echalex</dc:creator>
    <dc:date>2016-08-16T07:45:03Z</dc:date>
    <item>
      <title>Timechart with latest() doesn't display results when used on its own</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224952#M66301</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm trying to follow the disk usage as gather by the &lt;EM&gt;NIX app. I think the most appropriate timechart function would be &lt;CODE&gt;latest()&lt;/CODE&gt; since neither &lt;CODE&gt;max()&lt;/CODE&gt; nor &lt;CODE&gt;min()&lt;/CODE&gt; are quite what I need. However, I've noticed the weirdness that &lt;CODE&gt;latest()&lt;/CODE&gt; doesn't display any values in the visualisation *when used on its own.&lt;/EM&gt; BUT, if I also include &lt;CODE&gt;max()&lt;/CODE&gt;, then both values will be shown.&lt;/P&gt;

&lt;P&gt;Works (draws graphs for both values):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os host=foo OR host=bar sourcetype=df|eval hostmount=host+":"+MountedOn | timechart span=1h max(UsePct), latest(UsePct)  by hostmount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Doesn't work (no graph is drawn):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os host=foo OR host=bar sourcetype=df|eval hostmount=host+":"+MountedOn | timechart span=1h latest(UsePct)  by hostmount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've noticed that it also works if I use &lt;CODE&gt;latest()&lt;/CODE&gt; in combination  with any other statistical function, such as &lt;CODE&gt;median()&lt;/CODE&gt;, &lt;CODE&gt;avg()&lt;/CODE&gt;, &lt;CODE&gt;min()&lt;/CODE&gt;, etc. But it just doesn't work on its own. I'm using Splunk 6.2.4. Is this a bug or just something I'm not getting?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 08:29:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224952#M66301</guid>
      <dc:creator>echalex</dc:creator>
      <dc:date>2016-08-15T08:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with latest() doesn't display results when used on its own</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224953#M66302</link>
      <description>&lt;P&gt;I just tried on 6.3.4 and it seems to be the same.   If I had to guess, I'd say the problem is that latest doesn't work on numbers exclusively.  Which is nice, because you may want to get the latest value of any field, strings included.&lt;/P&gt;

&lt;P&gt;So with that in mind, using latest leaves the "%" on that field and maybe the timechart doesn't know what to do with it.  Where it's possible that the other stats functions (max, avg, median, etc) are converting it to a number to actually perform the statistical function?  And maybe if they're already doing it, then it gets done for latest too when it's included in the list?&lt;/P&gt;

&lt;P&gt;I did notice that if I run this eval before the timechart, it seems to work with latest() on its own&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval UsePct = trim(UsePct,"%")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure if there is a more "inherent" way of telling the timechart to just convert it to a number itself...&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 00:55:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224953#M66302</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2016-08-16T00:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with latest() doesn't display results when used on its own</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224954#M66303</link>
      <description>&lt;P&gt;Aha! Yes, you're definitely on the right track. I didn't consider that UsePct actually is a string with a %-sign at the end. When I check under the statistics-tab, I can see that latest(UsePct) on its own shows the values with a %-sign. If I also include max(UsePct), the sign is dropped from both values. Odd behaviour, perhaps, but whether it's a bug might be debatable.&lt;BR /&gt;
Your solutions is probably the simplest. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 07:45:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224954#M66303</guid>
      <dc:creator>echalex</dc:creator>
      <dc:date>2016-08-16T07:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart with latest() doesn't display results when used on its own</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224955#M66304</link>
      <description>&lt;P&gt;Had to check. &lt;CODE&gt;tonumber()&lt;/CODE&gt; won't work without &lt;CODE&gt;trim()&lt;/CODE&gt;, so your solution seems the best.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 07:56:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-with-latest-doesn-t-display-results-when-used-on-its/m-p/224955#M66304</guid>
      <dc:creator>echalex</dc:creator>
      <dc:date>2016-08-16T07:56:27Z</dc:date>
    </item>
  </channel>
</rss>

