<?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 How to return items dependent on occurrence in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475045#M133539</link>
    <description>&lt;P&gt;I have the data field "user" with data like: &lt;BR /&gt;
user1, user1, user2, user2, user3, user3, user3, ...&lt;/P&gt;

&lt;P&gt;How do I get/count all items with an occurrence &amp;lt; 3?&lt;/P&gt;

&lt;P&gt;Steffen&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2019 12:42:26 GMT</pubDate>
    <dc:creator>steffen1</dc:creator>
    <dc:date>2019-11-04T12:42:26Z</dc:date>
    <item>
      <title>How to return items dependent on occurrence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475045#M133539</link>
      <description>&lt;P&gt;I have the data field "user" with data like: &lt;BR /&gt;
user1, user1, user2, user2, user3, user3, user3, ...&lt;/P&gt;

&lt;P&gt;How do I get/count all items with an occurrence &amp;lt; 3?&lt;/P&gt;

&lt;P&gt;Steffen&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 12:42:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475045#M133539</guid>
      <dc:creator>steffen1</dc:creator>
      <dc:date>2019-11-04T12:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to return items dependent on occurrence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475046#M133540</link>
      <description>&lt;P&gt;Hi steffen1,&lt;BR /&gt;
you have only one user value for each event or do you have more values in each event?&lt;BR /&gt;
if the first, try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index
| stats count BY user
| where count&amp;lt;3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 16:10:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475046#M133540</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-11-04T16:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to return items dependent on occurrence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475047#M133541</link>
      <description>&lt;P&gt;Assuming you are talking about data inside single events (otherwise you can use the answer by @gcusello), like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="YouShouldAlwaysSpecifyAnIndex" AND sourctype="AndSourcetypeToo"
| makemv delim="," user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then either:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where mvcount(user)&amp;lt;3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where mvcount(mvdedup(user))&amp;lt;3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Nov 2019 16:28:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475047#M133541</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-04T16:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to return items dependent on occurrence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475048#M133542</link>
      <description>&lt;P&gt;But how to count this users? Do I have to save it to a variable first?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 07:10:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475048#M133542</guid>
      <dc:creator>steffen1</dc:creator>
      <dc:date>2019-11-05T07:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to return items dependent on occurrence</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475049#M133543</link>
      <description>&lt;P&gt;Sorry, but every user/username is in one event. In the end I want to count the occurrences of this names. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2019 07:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-return-items-dependent-on-occurrence/m-p/475049#M133543</guid>
      <dc:creator>steffen1</dc:creator>
      <dc:date>2019-11-05T07:15:29Z</dc:date>
    </item>
  </channel>
</rss>

