<?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: Is it possible to find the most common value of a field per user? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/130068#M35399</link>
    <description>&lt;P&gt;I think you are looking for mode(x):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;your search&amp;gt; | stats mode(country_code) by user_id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 07 Feb 2020 15:42:54 GMT</pubDate>
    <dc:creator>p3hndrx</dc:creator>
    <dc:date>2020-02-07T15:42:54Z</dc:date>
    <item>
      <title>Is it possible to find the most common value of a field per user?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/130066#M35397</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is it possible to find out the most common value of field=A for every user?&lt;/P&gt;

&lt;P&gt;I would expect something like this, but i don't know a corresponding stats function:&lt;/P&gt;

&lt;P&gt;... | stats &lt;EM&gt;function&lt;/EM&gt;(country_code) BY user_id &lt;/P&gt;

&lt;P&gt;BR&lt;/P&gt;

&lt;P&gt;Heinz&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:44:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/130066#M35397</guid>
      <dc:creator>HeinzWaescher</dc:creator>
      <dc:date>2020-09-29T06:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to find the most common value of a field per user?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/130067#M35398</link>
      <description>&lt;P&gt;Here, you would most likely want to use &lt;CODE&gt;top&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | top limit=1 country_code by user_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will give you the &lt;CODE&gt;top&lt;/CODE&gt; country_code, limit of 1 per user. &lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 11:37:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/130067#M35398</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-07-20T11:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to find the most common value of a field per user?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/130068#M35399</link>
      <description>&lt;P&gt;I think you are looking for mode(x):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;your search&amp;gt; | stats mode(country_code) by user_id
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Feb 2020 15:42:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/130068#M35399</guid>
      <dc:creator>p3hndrx</dc:creator>
      <dc:date>2020-02-07T15:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to find the most common value of a field per user?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/531135#M150047</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I agree that mode function&amp;nbsp;is most likely what&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214917"&gt;@HeinzWaescher&lt;/a&gt;&amp;nbsp; was looking for.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because it is a stats function, you can also use it with eventstats to keep the events.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eventstats mode(country_code) by user_id&lt;/LI-CODE&gt;&lt;P&gt;For the example initially provided, the top command does not appear any better than the stats mode() command provided by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/28390"&gt;@p3hndrx&lt;/a&gt;. But if you the top N values (N&amp;gt;=2), there is no function like values() that returns them sorted by frequency of occurrence.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 11:19:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-find-the-most-common-value-of-a-field-per-user/m-p/531135#M150047</guid>
      <dc:creator>malvidin</dc:creator>
      <dc:date>2020-11-27T11:19:12Z</dc:date>
    </item>
  </channel>
</rss>

