<?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 count the the number of elements in a fields after performing a set difference against other events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181486#M52300</link>
    <description>&lt;P&gt;Is this close enough?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... | eventstats mode(*) AS mode_* BY user | eval deviant_src=if((src==mode_src),null(),src) | eval deviant_dest=if((dest==mode_dest),null(),dest) | eval deviant_app=if((app==mode_app),null(),app) | stats values(deviant*) count(deviant*) BY user
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 29 Jun 2015 15:44:41 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-06-29T15:44:41Z</dc:date>
    <item>
      <title>How to count the the number of elements in a fields after performing a set difference against other events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181484#M52298</link>
      <description>&lt;P&gt;How could the number of elements in a tuple of fields be counted after performing a set difference against the other events?&lt;/P&gt;

&lt;P&gt;A trivial example:&lt;/P&gt;

&lt;P&gt;Fields: user, src, dest, app&lt;BR /&gt;
EventA: (alice, host1, host3, sso)&lt;BR /&gt;
EventB: (alice, host2, host3, sshd)&lt;BR /&gt;
EventC: (alice, host1, host3, sshd)&lt;/P&gt;

&lt;P&gt;The set difference of EventA and the other two events above would be the set: (sso) with a count of 1.&lt;/P&gt;

&lt;P&gt;Using an imaginary stats function, it might look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eventstats setdiff(src dest app) as difference by user | eval count=mvcount(difference)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jun 2015 11:15:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181484#M52298</guid>
      <dc:creator>doksu</dc:creator>
      <dc:date>2015-06-29T11:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the the number of elements in a fields after performing a set difference against other events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181485#M52299</link>
      <description>&lt;P&gt;Are you sure the answer to your example shouldn't be: (host2,sso)?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2015 15:29:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181485#M52299</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-29T15:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the the number of elements in a fields after performing a set difference against other events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181486#M52300</link>
      <description>&lt;P&gt;Is this close enough?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ... | eventstats mode(*) AS mode_* BY user | eval deviant_src=if((src==mode_src),null(),src) | eval deviant_dest=if((dest==mode_dest),null(),dest) | eval deviant_app=if((app==mode_app),null(),app) | stats values(deviant*) count(deviant*) BY user
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jun 2015 15:44:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181486#M52300</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-29T15:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the the number of elements in a fields after performing a set difference against other events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181487#M52301</link>
      <description>&lt;P&gt;Thanks for your answer woodcock. It's quite close and a really interesting answer but it looks like it would only apply the operation to the most common element for each field. Maybe I should submit an RFE?&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2015 10:24:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-the-number-of-elements-in-a-fields-after/m-p/181487#M52301</guid>
      <dc:creator>doksu</dc:creator>
      <dc:date>2015-07-10T10:24:59Z</dc:date>
    </item>
  </channel>
</rss>

