<?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: Filter count? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Filter-count/m-p/103881#M26872</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;Aliases="*hba*" 
| rex "Aliases:\s+(?&amp;lt;Aliname&amp;gt;\S+)_hba"
| chart distinct_count(Permanent_Port_Name) as PortNameCount values(Permanent_Port_Name) by Aliname 
| where PortNameCount = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will work, and I think it is what you want. Maybe.&lt;BR /&gt;&lt;BR /&gt;
There were several problems with your earlier attempts. First, the &lt;CODE&gt;where&lt;/CODE&gt; command does not have a count function. Second, the values function returns a list of the values, not a count. The &lt;CODE&gt;eval&lt;/CODE&gt; command does not have a count function either.&lt;/P&gt;

&lt;P&gt;A count can be computed using the &lt;CODE&gt;stats&lt;/CODE&gt;, &lt;CODE&gt;chart&lt;/CODE&gt; or &lt;CODE&gt;timechart&lt;/CODE&gt; commands. However, the count is the number of events - not the number of unique values. The distinct_count function returns the number of unique values of a field. However, you must give the field a name, by using the &lt;CODE&gt;as&lt;/CODE&gt; clause, if you want to refer to the field in subsequent commands.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jul 2012 07:28:46 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2012-07-20T07:28:46Z</dc:date>
    <item>
      <title>Filter count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-count/m-p/103880#M26871</link>
      <description>&lt;P&gt;Trying to output just names where the count=1. &lt;/P&gt;

&lt;P&gt;Original Search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Aliases="*hba*" | rex "Aliases:\s+(?&amp;lt;Aliname&amp;gt;\S+)_hba" | chart values(Permanent_Port_Name) by Aliname 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tried variations of the below- most complain that the count function is not supported. &lt;BR /&gt;
I've checked the documentation &amp;amp; havent found much on how to do this. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Aliases="*hba*" | rex "Aliases:\s+(?&amp;lt;Aliname&amp;gt;\S+)_hba" | where count(Aliname)=1 | chart values(Permanent_Port_Name) by Aliname 
Aliases="*hba*" | rex "Aliases:\s+(?&amp;lt;Aliname&amp;gt;\S+)_hba" | search count(Aliname)=1 | chart values(Permanent_Port_Name) by Aliname 
Aliases="*hba*" | rex "Aliases:\s+(?&amp;lt;Aliname&amp;gt;\S+)_hba" | eval FAIL=count(Aliname) | where FAIL=1 | chart values(Permanent_Port_Name) by Aliname 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Only want to chart where my count=1&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jul 2012 19:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-count/m-p/103880#M26871</guid>
      <dc:creator>clintla</dc:creator>
      <dc:date>2012-07-19T19:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Filter count?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Filter-count/m-p/103881#M26872</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Aliases="*hba*" 
| rex "Aliases:\s+(?&amp;lt;Aliname&amp;gt;\S+)_hba"
| chart distinct_count(Permanent_Port_Name) as PortNameCount values(Permanent_Port_Name) by Aliname 
| where PortNameCount = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will work, and I think it is what you want. Maybe.&lt;BR /&gt;&lt;BR /&gt;
There were several problems with your earlier attempts. First, the &lt;CODE&gt;where&lt;/CODE&gt; command does not have a count function. Second, the values function returns a list of the values, not a count. The &lt;CODE&gt;eval&lt;/CODE&gt; command does not have a count function either.&lt;/P&gt;

&lt;P&gt;A count can be computed using the &lt;CODE&gt;stats&lt;/CODE&gt;, &lt;CODE&gt;chart&lt;/CODE&gt; or &lt;CODE&gt;timechart&lt;/CODE&gt; commands. However, the count is the number of events - not the number of unique values. The distinct_count function returns the number of unique values of a field. However, you must give the field a name, by using the &lt;CODE&gt;as&lt;/CODE&gt; clause, if you want to refer to the field in subsequent commands.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 07:28:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Filter-count/m-p/103881#M26872</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-07-20T07:28:46Z</dc:date>
    </item>
  </channel>
</rss>

