<?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: Append Columns to Top Output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Append-Columns-to-Top-Output/m-p/289389#M162037</link>
    <description>&lt;P&gt;Hey&lt;/P&gt;

&lt;P&gt;Can you use eventstats before doing the count?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; `nagios_index` `nagios_core_sourcetype` host_name="*" ((eventname="SERVICE ALERT" NOT status_code="OK") OR 
 (eventname="HOST ALERT" NOT status_code="UP")) 
 | eval name=if(eventname=="HOST ALERT","Host",service) 
 | eventstats count(whatever_you_want_to_count) as CountField
 | top eventname,host_name,name,CountField limit="100"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 26 Mar 2018 10:20:58 GMT</pubDate>
    <dc:creator>tiagofbmm</dc:creator>
    <dc:date>2018-03-26T10:20:58Z</dc:date>
    <item>
      <title>Append Columns to Top Output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Append-Columns-to-Top-Output/m-p/289388#M162036</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have the following search and I would like to enumerate a total event count prior to the Top function and then append it to the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`nagios_index` `nagios_core_sourcetype` host_name="*" ((eventname="SERVICE ALERT" NOT status_code="OK") OR 
(eventname="HOST ALERT" NOT status_code="UP")) 
| eval name=if(eventname=="HOST ALERT","Host",service) 
| top eventname,host_name,name limit="100"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The macro's at the start just specify the index and sourcetype.  From what I can tell there is no way to append columns to Top's output? Any help on the best way to achieve the desired output would be greatly appreciated!&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 26 Mar 2018 10:13:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Append-Columns-to-Top-Output/m-p/289388#M162036</guid>
      <dc:creator>samhodgson</dc:creator>
      <dc:date>2018-03-26T10:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Append Columns to Top Output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Append-Columns-to-Top-Output/m-p/289389#M162037</link>
      <description>&lt;P&gt;Hey&lt;/P&gt;

&lt;P&gt;Can you use eventstats before doing the count?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; `nagios_index` `nagios_core_sourcetype` host_name="*" ((eventname="SERVICE ALERT" NOT status_code="OK") OR 
 (eventname="HOST ALERT" NOT status_code="UP")) 
 | eval name=if(eventname=="HOST ALERT","Host",service) 
 | eventstats count(whatever_you_want_to_count) as CountField
 | top eventname,host_name,name,CountField limit="100"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2018 10:20:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Append-Columns-to-Top-Output/m-p/289389#M162037</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-26T10:20:58Z</dc:date>
    </item>
  </channel>
</rss>

