<?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 exclude duplicate field values from different fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298587#M90005</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am writing a search string for Windows, which should return events where a privileged user (Source_User) has added a non-privileged (Target_User) user to a privileged group, or has assigned new privileges to this account.&lt;/P&gt;

&lt;P&gt;When running my search, I am receiving a number of events where the Source_User and Target_User values are the same (E.g. Privileges assigned at logon for a service account).&lt;/P&gt;

&lt;P&gt;I would like to remove duplicate values from my search (I.e. Source_User!=Target_User).  I have attempted what I'd consider to be the usual suspects (listed below), but am getting no where.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where Source_User!=Target_User

| search Source_User!=Target_User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone suggest other ways to do this?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 17:35:20 GMT</pubDate>
    <dc:creator>MikeElliott</dc:creator>
    <dc:date>2020-09-29T17:35:20Z</dc:date>
    <item>
      <title>How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298587#M90005</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am writing a search string for Windows, which should return events where a privileged user (Source_User) has added a non-privileged (Target_User) user to a privileged group, or has assigned new privileges to this account.&lt;/P&gt;

&lt;P&gt;When running my search, I am receiving a number of events where the Source_User and Target_User values are the same (E.g. Privileges assigned at logon for a service account).&lt;/P&gt;

&lt;P&gt;I would like to remove duplicate values from my search (I.e. Source_User!=Target_User).  I have attempted what I'd consider to be the usual suspects (listed below), but am getting no where.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| where Source_User!=Target_User

| search Source_User!=Target_User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can anyone suggest other ways to do this?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:35:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298587#M90005</guid>
      <dc:creator>MikeElliott</dc:creator>
      <dc:date>2020-09-29T17:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298588#M90006</link>
      <description>&lt;P&gt;&lt;CODE&gt;| where Source_User!=Target_User&lt;/CODE&gt; should work, as shown by this run-anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval Source_User="user1", Target_User="user1"
| append [| makeresults | eval Source_User="user1", Target_User="user2"]
| where Source_User!=Target_User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you include some sample data that doesn't work as expected?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 04:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298588#M90006</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T04:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298589#M90007</link>
      <description>&lt;P&gt;hey&lt;/P&gt;

&lt;P&gt;I think there might be a problem of case sensitivity.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your_base_query&amp;gt;| eval Source_User=lower(Source_User) | eval Target_User=lower(Target_User) | where Source_User!=Target_User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope that helps !&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 04:36:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298589#M90007</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-09T04:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298590#M90008</link>
      <description>&lt;P&gt;Hi mayurr98,&lt;/P&gt;

&lt;P&gt;Thank you for your help.  Unfortunately, when adding your suggestions to the search, all results have been excluded.&lt;/P&gt;

&lt;P&gt;I tried renaming the fields to use lower case characters and then using the |where command, but still, all results were excluded.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 05:16:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298590#M90008</guid>
      <dc:creator>MikeElliott</dc:creator>
      <dc:date>2018-01-09T05:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298591#M90009</link>
      <description>&lt;P&gt;Are the Source_User and Target_User values exact matches? Does one field use &lt;CODE&gt;domain\user&lt;/CODE&gt; and the other just &lt;CODE&gt;user&lt;/CODE&gt;, for instance?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:31:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298591#M90009</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2020-09-29T17:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298592#M90010</link>
      <description>&lt;P&gt;Hi miachkemp,&lt;/P&gt;

&lt;P&gt;Many thanks for your suggestion.  I have included example data below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Source_User      Target_User
Admin_001        Admin_001
Admin_001        Admin_001
Admin_001        User_001
Admin_002        User_002
Admin_001        User_003
svc_account      svc_account
Admin_003        User_004
User_004              some_account
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to be able to exclude events where there is a duplicate account under "Source User" and "Target User" headings.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 05:23:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298592#M90010</guid>
      <dc:creator>MikeElliott</dc:creator>
      <dc:date>2018-01-09T05:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298593#M90011</link>
      <description>&lt;P&gt;Is this a single event with multiple values per field? Or is each line above a separate event?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 05:24:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298593#M90011</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-01-09T05:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298594#M90012</link>
      <description>&lt;P&gt;Hi MikeElliott,&lt;/P&gt;

&lt;P&gt;could you please share what search you are running with some sample data?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 05:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298594#M90012</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-01-09T05:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298595#M90013</link>
      <description>&lt;P&gt;Yes, the field values are exact matches - Just the usernames.  &lt;CODE&gt;domain\user&lt;/CODE&gt; comes under a different field in this index.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 05:33:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298595#M90013</guid>
      <dc:creator>MikeElliott</dc:creator>
      <dc:date>2018-01-09T05:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298596#M90014</link>
      <description>&lt;P&gt;Also can you share output table wrt input table that you have given?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 05:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298596#M90014</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-01-09T05:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298597#M90015</link>
      <description>&lt;P&gt;It seems likely that you have run a search like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt;
| stats values(Source_User) AS Source_User, values(Target_User) AS Target_User
| where Source_User!=Target_User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this is the case, try this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt;
| where Source_User!=Target_User
| stats values(Source_User) AS Source_User, values(Target_User) AS Target_User
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You are comparing a single event's Source_User and Target_User field, so you need to make sure you perform that comparison prior to running a reporting command.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:31:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298597#M90015</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2020-09-29T17:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to exclude duplicate field values from different fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298598#M90016</link>
      <description>&lt;P&gt;Hi micahkemp,&lt;/P&gt;

&lt;P&gt;Apologies for leaving this so late, but after tweaking my search slightly, I found that your solution was the one for me!&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 17:17:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-exclude-duplicate-field-values-from-different-fields/m-p/298598#M90016</guid>
      <dc:creator>MikeElliott</dc:creator>
      <dc:date>2018-03-13T17:17:23Z</dc:date>
    </item>
  </channel>
</rss>

