<?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: How to display &amp;quot;(2)&amp;quot; next to hostname when a second host has been detected in the list? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373641#M67713</link>
    <description>&lt;P&gt;Or you can do :  &lt;/P&gt;

&lt;P&gt;Your search | fields host, _time | eventstats count(host) as hostCount by _time | eval hostAndCount = host.” (“.hostCount.”)” | table host, hostAndCount, hostCount, _time&lt;/P&gt;</description>
    <pubDate>Fri, 23 Mar 2018 12:01:00 GMT</pubDate>
    <dc:creator>damiensurat</dc:creator>
    <dc:date>2018-03-23T12:01:00Z</dc:date>
    <item>
      <title>How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373637#M67709</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;

&lt;P&gt;I have a simple search that returns a list of host and time stamps:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host   _time
x      2018-03-23 11:54
y      2018-03-23 11:55
z      2018-03-23 11:56
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's possible to have 2 times the same host in the list, in that case I would like to have "(2)" displayed next to the name of the second host, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host   _time
x      2018-03-23 11:54
y      2018-03-23 11:55
x(2)   2018-03-23 11:55
z      2018-03-23 11:56
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I do that?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 10:57:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373637#M67709</guid>
      <dc:creator>lucien62</dc:creator>
      <dc:date>2018-03-23T10:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373638#M67710</link>
      <description>&lt;P&gt;In which cases do you want to have duplicated values of host?&lt;/P&gt;

&lt;P&gt;I don't know which search are doing there but if you are doing a stats latest(host) by _time, a stats values(host) by _time gives as many values as existing in the field ( instead of having one per host).&lt;/P&gt;

&lt;P&gt;But I think more clarifications would be frutiful here.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 11:25:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373638#M67710</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-23T11:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373639#M67711</link>
      <description>&lt;P&gt;Do you want the 2 next to the host and in the same column, or a separate column with the count of hosts?  &lt;/P&gt;

&lt;P&gt;Your search | fields host, _time | eventstats count(host) as hostCount by _time | table host, hostCount, _time&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 11:46:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373639#M67711</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2018-03-23T11:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373640#M67712</link>
      <description>&lt;P&gt;@lucien62 try the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourBaseSearch&amp;gt;
| streamstats count as sno by host
| eval host=host."(".sno.")"
| table _time host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a run anywhere search based on Splunk's _internal index which which samples some splunkd errors and display count of host with errors over time:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="_internal" sourcetype="splunkd" log_level!="INFO" component!="Metrics" AND component!="ExecProcessor" 
| head 50
| streamstats count as sno by component
| eval component=component."(".sno.")"
| table _time component
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: I have used streamstats to apply statistical aggregate on streaming data over time based on your sample data. If you have stats, similar approach should still work. Please try out and confirm.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 11:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373640#M67712</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-23T11:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373641#M67713</link>
      <description>&lt;P&gt;Or you can do :  &lt;/P&gt;

&lt;P&gt;Your search | fields host, _time | eventstats count(host) as hostCount by _time | eval hostAndCount = host.” (“.hostCount.”)” | table host, hostAndCount, hostCount, _time&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 12:01:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373641#M67713</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2018-03-23T12:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373642#M67714</link>
      <description>&lt;P&gt;I would prefer having the "2" next to the host name in the same column.&lt;/P&gt;

&lt;P&gt;This will be used to identify when the same log is detected on the same server but at a different time. &lt;/P&gt;

&lt;P&gt;This is the current search I'm using:&lt;/P&gt;

&lt;P&gt;index=wineventlog host=* EventCode=55555 Message="blablabla..."  | table host _time | sort -_time asc&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:38:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373642#M67714</guid>
      <dc:creator>lucien62</dc:creator>
      <dc:date>2020-09-29T18:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373643#M67715</link>
      <description>&lt;P&gt;In situations where you only want to show a numeric if the host count is greater than one:  Your search | fields host, _time | eventstats count(host) as hostCount by _time | eval hostAndCount = if(hostCount &amp;gt; 1, host.” (“.hostCount.”)” , host) | table host, hostAndCount, hostCount, _time&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 12:07:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373643#M67715</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2018-03-23T12:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373644#M67716</link>
      <description>&lt;P&gt;Do you want the 2 next to the host and in the same column, or a separate column with the count of hosts?&lt;/P&gt;

&lt;P&gt;Your search | fields host, _time | eventstats count(host) as hostCount by _time | table host, hostCount, _time&lt;/P&gt;

&lt;P&gt;Your search | fields host, _time | eventstats count(host) as hostCount by _time | eval hostAndCount = host.” (“.hostCount.”)” | table host, hostAndCount, hostCount, _time&lt;/P&gt;

&lt;P&gt;In situations where you only want to show a numeric if the host count is greater than one: Your search | fields host, _time | eventstats count(host) as hostCount by _time | eval hostAndCount = if(hostCount &amp;gt; 1, host.” (“.hostCount.”)” , host) | table host, hostAndCount, hostCount, _time&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 12:11:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373644#M67716</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2018-03-23T12:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373645#M67717</link>
      <description>&lt;P&gt;So you don’t want to split by time then. &lt;/P&gt;

&lt;P&gt;Your search | fields host, _time | eventstats count(host) as hostCount | eval host = if(hostCount &amp;gt; 1, host.” (“.hostCount.”)” , host) | table host, _time&lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 12:16:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373645#M67717</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2018-03-23T12:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to display "(2)" next to hostname when a second host has been detected in the list?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373646#M67718</link>
      <description>&lt;P&gt;Btw. What the above search does is is counts all hosts by host name over your search time and then concatinates that sum of hosts next to your host if the resultant host count is greater than 2. Since I assume you are scanning events by _time which is what is populating the time field, you will see duplicate results if you come across more than one host with the same host name. Eg:&lt;BR /&gt;
1:20 host1 (2)&lt;BR /&gt;
1:22 host2&lt;BR /&gt;
1:24 host1 (2) &lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2018 12:27:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-quot-2-quot-next-to-hostname-when-a-second-host/m-p/373646#M67718</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2018-03-23T12:27:46Z</dc:date>
    </item>
  </channel>
</rss>

