<?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: Display &amp;quot;stats&amp;quot; Search as a Single Value from Summary Index in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Display-quot-stats-quot-Search-as-a-Single-Value-from-Summary/m-p/358433#M174552</link>
    <description>&lt;P&gt;You can use stats twice if you like! Just append&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count(eval(status="Available")) AS Available
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to the end of the search&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2017 13:50:53 GMT</pubDate>
    <dc:creator>jplumsdaine22</dc:creator>
    <dc:date>2017-06-20T13:50:53Z</dc:date>
    <item>
      <title>Display "stats" Search as a Single Value from Summary Index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-quot-stats-quot-Search-as-a-Single-Value-from-Summary/m-p/358432#M174551</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;Normally, I would use the following search to find my single value:&lt;/P&gt;

&lt;P&gt;| tstats latest(_time) as latest where host=($SERVERNAME) by host&lt;BR /&gt;
| eval noDataTime = now() - latest&lt;BR /&gt;
| eval status = if(noDataTime&amp;gt;600,"HOST DOWN" ,if(noDataTime&amp;gt;300,"Warning","Available"))&lt;BR /&gt;
| stats count(eval(status="Available")) AS Available&lt;/P&gt;

&lt;P&gt;I am now forwarding the machine data to a summary index that my host names are now listed as "orig_host" in the fields. This will not allow me to run tstats, so I made the following search to find the status of the servers:&lt;/P&gt;

&lt;P&gt;orig_host=("$SERVERNAME) &lt;BR /&gt;
| stats latest(_time) as latest by orig_host&lt;BR /&gt;
| eval noDataTime = now() - latest&lt;BR /&gt;
| eval status = if(noDataTime&amp;gt;600,"HOST DOWN" ,if(noDataTime&amp;gt;300,"Warning","Available"))&lt;BR /&gt;
| convert ctime(latest)&lt;/P&gt;

&lt;P&gt;This will list the servers and show their status as HOST DOWN, Warning and Available. I would like to convert this to a single value, which in the past I used "stats count", but have already used "stats" in the search previously. How would I change my search of "orig_host" to a single value? Thank you!  &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-quot-stats-quot-Search-as-a-Single-Value-from-Summary/m-p/358432#M174551</guid>
      <dc:creator>curry59</dc:creator>
      <dc:date>2020-09-29T14:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Display "stats" Search as a Single Value from Summary Index</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Display-quot-stats-quot-Search-as-a-Single-Value-from-Summary/m-p/358433#M174552</link>
      <description>&lt;P&gt;You can use stats twice if you like! Just append&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count(eval(status="Available")) AS Available
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to the end of the search&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 13:50:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Display-quot-stats-quot-Search-as-a-Single-Value-from-Summary/m-p/358433#M174552</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2017-06-20T13:50:53Z</dc:date>
    </item>
  </channel>
</rss>

