<?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 Extracting a username from logs files using Regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18386#M2663</link>
    <description>&lt;P&gt;Hi im trying to extract domain usernames from my juniper log files using regex however depending on the log message the fully qualified domain name isnt always displayed&lt;/P&gt;

&lt;P&gt;See example below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;line 1:      juniper -ive -] domain/user1(realm) etc. etc.
Line2:       juniper -ive -] user2(realm) etc. etc.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i would like to extract just the username into a group so i'm trying to exclude the word "DOMAIN/" so far i have this:&lt;/P&gt;

&lt;P&gt;]\s(?!DOMAIN\/\b)([a-z_0-9]+)&lt;/P&gt;

&lt;P&gt;however it only seems to capture user2&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Wed, 04 Apr 2012 14:44:20 GMT</pubDate>
    <dc:creator>ifsuser</dc:creator>
    <dc:date>2012-04-04T14:44:20Z</dc:date>
    <item>
      <title>Extracting a username from logs files using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18386#M2663</link>
      <description>&lt;P&gt;Hi im trying to extract domain usernames from my juniper log files using regex however depending on the log message the fully qualified domain name isnt always displayed&lt;/P&gt;

&lt;P&gt;See example below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;line 1:      juniper -ive -] domain/user1(realm) etc. etc.
Line2:       juniper -ive -] user2(realm) etc. etc.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i would like to extract just the username into a group so i'm trying to exclude the word "DOMAIN/" so far i have this:&lt;/P&gt;

&lt;P&gt;]\s(?!DOMAIN\/\b)([a-z_0-9]+)&lt;/P&gt;

&lt;P&gt;however it only seems to capture user2&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 14:44:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18386#M2663</guid>
      <dc:creator>ifsuser</dc:creator>
      <dc:date>2012-04-04T14:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a username from logs files using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18387#M2664</link>
      <description>&lt;P&gt;does it support negative/positive lookahead and lookbehind?&lt;BR /&gt;
your (?!) is a negative lookahead, you need a positive lookbehind if using "domain/"&lt;/P&gt;

&lt;P&gt;maybe this&lt;BR /&gt;
([A-Za-z]{1,10}([0-9]{1,5})?)(?=\()|(?&amp;lt;=/)([A-Za-z]{1,10}([0-9]{1,5})?)&lt;BR /&gt;
or&lt;BR /&gt;
([A-Za-z]{1,10}(\d+)?)(?=\()|(?&amp;lt;=/)([A-Za-z]{1,10}(\d+)?)&lt;/P&gt;

&lt;P&gt;but a single pos lookahead should suffice&lt;BR /&gt;
([A-Za-z]{1,10}(\d+)?)(?=\(realm\))&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 15:35:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18387#M2664</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2012-04-04T15:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a username from logs files using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18388#M2665</link>
      <description>&lt;P&gt;this one might work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;ive\s+-\]\s+((?&amp;lt;domain&amp;gt;\w+)/)?(?&amp;lt;user&amp;gt;\w+)\((?&amp;lt;realm&amp;gt;\w+)\)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2012 16:25:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18388#M2665</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2012-04-04T16:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a username from logs files using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18389#M2666</link>
      <description>&lt;P&gt;This should work too:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;-]\s((?&amp;lt;domain&amp;gt;\w+)/)?(?&amp;lt;user&amp;gt;\w+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 16:46:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18389#M2666</guid>
      <dc:creator>RicoSuave</dc:creator>
      <dc:date>2012-04-04T16:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a username from logs files using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18390#M2667</link>
      <description>&lt;P&gt;Hi guys, neither of them worked, in the end i used this:&lt;/P&gt;

&lt;P&gt;]\s(?:DOMAIN\*)?(.\w+)&lt;/P&gt;

&lt;P&gt;but thanks anyways&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 10:10:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18390#M2667</guid>
      <dc:creator>ifsuser</dc:creator>
      <dc:date>2012-04-05T10:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a username from logs files using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18391#M2668</link>
      <description>&lt;P&gt;That's odd. I tested it and it works. But, if your regex is now working, that's all that matters. Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 13:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18391#M2668</guid>
      <dc:creator>RicoSuave</dc:creator>
      <dc:date>2012-04-05T13:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a username from logs files using Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18392#M2669</link>
      <description>&lt;P&gt;pls escape backslashes with a \ otherwise we readers see confusing stuff because this forum takes a single \ as a special char. a real pita imho.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 18:32:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-a-username-from-logs-files-using-Regex/m-p/18392#M2669</guid>
      <dc:creator>cvajs</dc:creator>
      <dc:date>2012-04-05T18:32:20Z</dc:date>
    </item>
  </channel>
</rss>

