<?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: Field Extraction - Trim Existing Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24383#M4472</link>
    <description>&lt;P&gt;no worries... what's with the "b" in your regex?&lt;/P&gt;</description>
    <pubDate>Thu, 02 Aug 2012 19:37:04 GMT</pubDate>
    <dc:creator>MHibbin</dc:creator>
    <dc:date>2012-08-02T19:37:04Z</dc:date>
    <item>
      <title>Field Extraction - Trim Existing Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24380#M4469</link>
      <description>&lt;P&gt;In some of our event logs, the client IP address is recorded with leading information (::ffff:).  I would like to trim this data and create a new field, which I can then do a reverse dns lookup on using a scripted lookup.&lt;/P&gt;

&lt;P&gt;I'm not looking to modify the index, I'd like all of this to happen at search time.&lt;BR /&gt;
The field I'm looking to modify is called Client_Address and a sample value would be:&lt;BR /&gt;
  ::ffff:192.168.207.88&lt;/P&gt;

&lt;P&gt;If I use the following REX at search time, I get a new field called Client_IP that looks good:&lt;BR /&gt;
  rex field=Client_Address "(?&lt;CLIENT_IP&gt;\b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b)"&lt;/CLIENT_IP&gt;&lt;/P&gt;

&lt;P&gt;However, I'd like to use props.conf so this all happens automatically.  If I add the following line to my WinEventLog:Security stanza, it doesn't work.&lt;/P&gt;

&lt;P&gt;EXTRACT-ClientIP = rex field=Client_Address "(?&lt;CLIENT_IP&gt;\b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b)"&lt;/CLIENT_IP&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:11:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24380#M4469</guid>
      <dc:creator>jchampagne</dc:creator>
      <dc:date>2020-09-28T12:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction - Trim Existing Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24381#M4470</link>
      <description>&lt;P&gt;Firstly you don't need the rex part that is a search command.&lt;/P&gt;

&lt;P&gt;You should look at the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/admin/propsconf"&gt;props.conf spec file&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;Try something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-ClientIP = [:,f]*(?&amp;lt;ip&amp;gt;\d+\.\d+\.\d+\.\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-ClientIP = [:,f]*(?&amp;lt;ip&amp;gt;\d{1,3}\.\{1,3}\.\d{1,3}\.\d{1,3})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or you can just use the Interactive Field Extractor to help with the config of the props.conf (if you do the regex in IFX and save it, it will do the file itself.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2012 19:27:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24381#M4470</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-08-02T19:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction - Trim Existing Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24382#M4471</link>
      <description>&lt;P&gt;Thanks for the help!&lt;BR /&gt;
I ended up using the following line, which seems to work.&lt;/P&gt;

&lt;P&gt;EXTRACT-ClientIP = (?&lt;CLIENT_IP&gt;\b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b)&lt;/CLIENT_IP&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2012 19:34:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24382#M4471</guid>
      <dc:creator>jchampagne</dc:creator>
      <dc:date>2012-08-02T19:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction - Trim Existing Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24383#M4472</link>
      <description>&lt;P&gt;no worries... what's with the "b" in your regex?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2012 19:37:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Trim-Existing-Field/m-p/24383#M4472</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2012-08-02T19:37:04Z</dc:date>
    </item>
  </channel>
</rss>

