<?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: User Name field extraction - Strip DOMAIN in username in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284044#M85863</link>
    <description>&lt;P&gt;I have tried this workaround but it seems that it doesn't work all the time.&lt;/P&gt;

&lt;P&gt;I have 4 sourcetypes (for Sophos Endpoint logs) and I have created this configuration for all of them at the same files (local folder of Splunk_TA_sophos app).&lt;/P&gt;

&lt;P&gt;It seems that it works for the three of them and not for the forth. Any ideas why this is happens?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 09:39:14 GMT</pubDate>
    <dc:creator>andresito123</dc:creator>
    <dc:date>2020-09-29T09:39:14Z</dc:date>
    <item>
      <title>User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284037#M85856</link>
      <description>&lt;P&gt;I have a field extraction which extracts the User Name.  Some users will authenticate with their user name, but some will also pre-fix it by the domain.&lt;/P&gt;

&lt;P&gt;How can I strip out the domain in the field extraction if the user includes the domain to authenticate?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;username=john.doe
username=domain\john.doe
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I referred to this &lt;A href="https://answers.splunk.com/answers/172242/how-to-use-rex-to-remove-the-domain-from-the-user.html"&gt;https://answers.splunk.com/answers/172242/how-to-use-rex-to-remove-the-domain-from-the-user.html&lt;/A&gt; , but the extraction will only extract those user names pre-fixed by domain.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 07:08:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284037#M85856</guid>
      <dc:creator>pjohnson1</dc:creator>
      <dc:date>2015-10-20T07:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284038#M85857</link>
      <description>&lt;P&gt;Hi pjohnson1,&lt;/P&gt;

&lt;P&gt;try this crazy &lt;CODE&gt;regex&lt;/CODE&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search here | rex "(?:=(?!\w+\\)|(?&amp;lt;!=)\\)(?&amp;lt;user&amp;gt;\S+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will search for a &lt;CODE&gt;=&lt;/CODE&gt; not followed by a word character and a &lt;CODE&gt;\&lt;/CODE&gt; or a &lt;CODE&gt;\&lt;/CODE&gt; not leaded by a &lt;CODE&gt;=&lt;/CODE&gt; and takes in any non whitespace character as field &lt;CODE&gt;user&lt;/CODE&gt; - tested and working on &lt;A href="http://regex101.com"&gt;http://regex101.com&lt;/A&gt; and you will get a better explanation there as well &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2015 09:15:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284038#M85857</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-20T09:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284039#M85858</link>
      <description>&lt;P&gt;Hi MuS,&lt;/P&gt;

&lt;P&gt;Thanks for the comment.&lt;/P&gt;

&lt;P&gt;I tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=authentication eventtype="aruba-user-authenticated" | rex "(?:=(?!\w+\\\)|(?&amp;lt;!=)\\\)(?&amp;lt;user&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it matches&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;username=john.doe
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but fails&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;username=domain\john.doe
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2015 11:54:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284039#M85858</guid>
      <dc:creator>pjohnson1</dc:creator>
      <dc:date>2015-10-20T11:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284040#M85859</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=username mode=sed "s/[^\\]*[\\]//"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2015 13:41:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284040#M85859</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-10-20T13:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284041#M85860</link>
      <description>&lt;P&gt;You can modify your field extraction logic pull out both the user and domain, and allow the domain to be skipped if not present.&lt;/P&gt;

&lt;P&gt;The sample below will extract three fields. &lt;EM&gt;username&lt;/EM&gt; will contain the full results, &lt;EM&gt;user_domain&lt;/EM&gt; will contain "domain" in second example above, and will be blank for the first. &lt;EM&gt;user&lt;/EM&gt; will contain john.doe for both examples you gave.&lt;/P&gt;

&lt;P&gt;Put the following into your transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[user-with-domain]
REGEX = username=((?:([^\\]+)\\)?(\S+))
FORMAT = username:$1 user_domain::$2 user::$3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And activate it via props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  [mysourcetype]
  REPORT-user = user-with-domain
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2015 13:46:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284041#M85860</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2015-10-20T13:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284042#M85861</link>
      <description>&lt;P&gt;Sorry my bad, just add &lt;CODE&gt;max_match=0&lt;/CODE&gt; to the regex and it will match everything:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; tag=authentication eventtype="aruba-user-authenticated" | rex max_match=0 "(?:=(?!\w+\\\)|(?&amp;lt;!=)\\\)(?&amp;lt;user&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2015 20:42:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284042#M85861</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-20T20:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284043#M85862</link>
      <description>&lt;P&gt;this will work as run everywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval foo="
username=john.doe
username=domain\john.doe
username=other_domain\foo.baz" | rex max_match=0 field=foo "(?:=(?!\w+\\\)|(?&amp;lt;!=)\\\)(?&amp;lt;user&amp;gt;\S+)"  | table user
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Oct 2015 20:43:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284043#M85862</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-10-20T20:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: User Name field extraction - Strip DOMAIN in username</title>
      <link>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284044#M85863</link>
      <description>&lt;P&gt;I have tried this workaround but it seems that it doesn't work all the time.&lt;/P&gt;

&lt;P&gt;I have 4 sourcetypes (for Sophos Endpoint logs) and I have created this configuration for all of them at the same files (local folder of Splunk_TA_sophos app).&lt;/P&gt;

&lt;P&gt;It seems that it works for the three of them and not for the forth. Any ideas why this is happens?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:39:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/User-Name-field-extraction-Strip-DOMAIN-in-username/m-p/284044#M85863</guid>
      <dc:creator>andresito123</dc:creator>
      <dc:date>2020-09-29T09:39:14Z</dc:date>
    </item>
  </channel>
</rss>

