<?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: Extract IP address and user name for log in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37467#M8377</link>
    <description>&lt;P&gt;Put this in your &lt;CODE&gt;props.conf&lt;/CODE&gt; to get it all in one go. Assumes that the ip-address is inside the first set of square brackets in each event, and the username follows immediately after that (well, with a whitespace in between actually). The username can only contain &lt;CODE&gt;A-Z, a-z, 0-9, -&lt;/CODE&gt; and &lt;CODE&gt;_&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your sourcetype]
EXTRACT-get_stuff = ^[\[]+\[(?&amp;lt;ip_adress&amp;gt;[\]]+)\]\s+(?&amp;lt;user_name&amp;gt;[-\w]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
    <pubDate>Fri, 17 May 2013 07:04:49 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2013-05-17T07:04:49Z</dc:date>
    <item>
      <title>Extract IP address and user name for log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37464#M8374</link>
      <description>&lt;P&gt;Im trying to extract the IP address in the [] and the user name which follows it. &lt;BR /&gt;
I tried a few different regex with no success., &lt;/P&gt;

&lt;P&gt;Any recommendations ?&lt;/P&gt;

&lt;P&gt;May 16 15:39:57 192.x.x.x Juniper: 2013-05-16 16:39:58 - ive - [24.x.x.x] bob_b(Company - OTP)[VIT Users] - Key Exchange number 1 occured for user with NCIP 192.x.x.x &lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2013 01:05:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37464#M8374</guid>
      <dc:creator>tevgey23</dc:creator>
      <dc:date>2013-05-17T01:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract IP address and user name for log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37465#M8375</link>
      <description>&lt;P&gt;Try these field extraction:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i) ive \- \[(?P&amp;lt;IP_Address&amp;gt;[^\]]+)
(?i) OTP\)\[(?P&amp;lt;User_Name&amp;gt;[^\]]+) when user is VIT Users

(?i)^[^\]]*\]\s+(?P&amp;lt;User_name&amp;gt;[^\(]+) when user is bob_b
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 May 2013 01:25:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37465#M8375</guid>
      <dc:creator>kml_uvce</dc:creator>
      <dc:date>2013-05-17T01:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Extract IP address and user name for log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37466#M8376</link>
      <description>&lt;P&gt;Thank you for the reply. Seems to come up with an error &lt;/P&gt;

&lt;P&gt;...| regex "(?i) ive - [(?P&lt;IP_ADDRESS&gt;[^]]+)"&lt;/IP_ADDRESS&gt;&lt;/P&gt;

&lt;P&gt;"Error in 'SearchOperator:regex': Usage: regex &lt;FIELD&gt; "(=|!=) &lt;REGEX&gt;&lt;/REGEX&gt;&lt;/FIELD&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2013 01:34:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37466#M8376</guid>
      <dc:creator>tevgey23</dc:creator>
      <dc:date>2013-05-17T01:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extract IP address and user name for log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37467#M8377</link>
      <description>&lt;P&gt;Put this in your &lt;CODE&gt;props.conf&lt;/CODE&gt; to get it all in one go. Assumes that the ip-address is inside the first set of square brackets in each event, and the username follows immediately after that (well, with a whitespace in between actually). The username can only contain &lt;CODE&gt;A-Z, a-z, 0-9, -&lt;/CODE&gt; and &lt;CODE&gt;_&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your sourcetype]
EXTRACT-get_stuff = ^[\[]+\[(?&amp;lt;ip_adress&amp;gt;[\]]+)\]\s+(?&amp;lt;user_name&amp;gt;[-\w]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Fri, 17 May 2013 07:04:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37467#M8377</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-05-17T07:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: Extract IP address and user name for log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37468#M8378</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;P&gt;your search|rex field=_raw "(?i)[(?P&lt;IP_ADDRESS&gt;[^]]+)"|rex field=_raw "(?i)^[^]]*]\s+(?P&lt;USER_NAME&gt;[^(]+)"&lt;/USER_NAME&gt;&lt;/IP_ADDRESS&gt;&lt;/P&gt;

&lt;P&gt;you can also combine these 2 fields in one rex.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-IP-address-and-user-name-for-log/m-p/37468#M8378</guid>
      <dc:creator>kml_uvce</dc:creator>
      <dc:date>2020-09-28T13:55:51Z</dc:date>
    </item>
  </channel>
</rss>

