<?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 Question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45048#M10628</link>
    <description>&lt;P&gt;I forgot to say thanks for your help. I added more to my question above which will hopefully confirm what I am seeking&lt;/P&gt;</description>
    <pubDate>Tue, 07 Sep 2010 22:57:28 GMT</pubDate>
    <dc:creator>Ant1D</dc:creator>
    <dc:date>2010-09-07T22:57:28Z</dc:date>
    <item>
      <title>Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45045#M10625</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;I am having a look at transforms.conf and props.conf configuration files and wondering about the following question:&lt;/P&gt;

&lt;P&gt;How do you do a field extraction from the source field (i.e. field=source) at search time?
(An example of this would be great to see)&lt;/P&gt;

&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;To add to what I said above:&lt;/P&gt;

&lt;P&gt;The source field displays a file path when you run a search in Splunk. There is a word within that file path which I want Splunk to extract and place in a field called TheWord.
How can I achieve this using props.conf and/or transforms.conf?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2010 21:50:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45045#M10625</guid>
      <dc:creator>Ant1D</dc:creator>
      <dc:date>2010-09-07T21:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45046#M10626</link>
      <description>&lt;P&gt;You can set up the just the props.conf to extract fields at search time.&lt;/P&gt;

&lt;P&gt;I'm going to use my environment as an example.  Our Apache logs are pipe | delimited.  So I have the following in my props.conf:&lt;/P&gt;

&lt;P&gt;[prod_apache_logs]&lt;/P&gt;

&lt;P&gt;EXTRACT- = (?P[\d]+.[\d]+.[\d]+.[\d]+)\|[(?P[\d]{2}\/[\w]{3}\/[\d]{4}):(?P[\d]{2}:[\d]{2}:[\d]{2})\s-[\d]+]\|(?P[\d]+)\|\"(?P[\S]+)\s(?P\/[\S]+)\s(?P.&lt;EM&gt;)\"\|(?P[\d]+)\|(?P[\W\d]+)\|(?P.&lt;/EM&gt;)\|(?P.*)&lt;/P&gt;

&lt;P&gt;prod_apache_logs = sourcetype of my apache logs.&lt;/P&gt;

&lt;P&gt;Easiest way to test this is to use the "rex" command in the search. IE, I would use something like this:&lt;/P&gt;

&lt;P&gt;sourcetype="prod_apache_logs" | rex "(?P[\d]+.[\d]+.[\d]+.[\d]+)\|[(?P[\d]{2}\/[\w]{3}\/[\d]{4}):(?P[\d]{2}:[\d]{2}:[\d]{2})\s-[\d]+]\|(?P[\d]+)\|\"(?P[\S]+)\s(?P\/[\S]+)\s(?P.&lt;EM&gt;)\"\|(?P[\d]+)\|(?P[\W\d]+)\|(?P.&lt;/EM&gt;)\|(?P.*)"&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2010 22:15:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45046#M10626</guid>
      <dc:creator>Brian_Osburn</dc:creator>
      <dc:date>2010-09-07T22:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45047#M10627</link>
      <description>&lt;P&gt;The data that I want to extract is not in _raw but it is in source. Therefore I don't believe this will work. I tried this and it did not work as expected.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2010 22:47:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45047#M10627</guid>
      <dc:creator>Ant1D</dc:creator>
      <dc:date>2010-09-07T22:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45048#M10628</link>
      <description>&lt;P&gt;I forgot to say thanks for your help. I added more to my question above which will hopefully confirm what I am seeking&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2010 22:57:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45048#M10628</guid>
      <dc:creator>Ant1D</dc:creator>
      <dc:date>2010-09-07T22:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45049#M10629</link>
      <description>&lt;P&gt;Okay, I just read your update.  I'm not sure how you would do it in in props.conf or transforms.conf.. I know you can do it via the standard search using eval and ltrim / rtrim..&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2010 23:00:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45049#M10629</guid>
      <dc:creator>Brian_Osburn</dc:creator>
      <dc:date>2010-09-07T23:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45050#M10630</link>
      <description>&lt;P&gt;How would I do it using eval and ltrim/rtrim?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2010 23:10:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45050#M10630</guid>
      <dc:creator>Ant1D</dc:creator>
      <dc:date>2010-09-07T23:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45051#M10631</link>
      <description>&lt;P&gt;If you provide an example of your source, I'll write up the exact command.&lt;/P&gt;

&lt;P&gt;In my case, my source is something like this: /opt/http/logs/&lt;A href="http://www.mysite.com-access.log" target="_blank"&gt;www.mysite.com-access.log&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;Using ltrim / rtrim, I extract out the /opt/http/logs and the -access.log to leave me with &lt;A href="http://www.mysite.com:" target="_blank"&gt;www.mysite.com:&lt;/A&gt;&lt;BR /&gt;
..| eval web_site=ltrim(source,"/opt/httpd/logs") | eval web_site=rtrim(web_site,"-access.log")&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:17:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45051#M10631</guid>
      <dc:creator>Brian_Osburn</dc:creator>
      <dc:date>2020-09-28T09:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45052#M10632</link>
      <description>&lt;P&gt;Have a look at &lt;A href="http://answers.splunk.com/questions/6511/field-extraction-mystery"&gt;http://answers.splunk.com/questions/6511/field-extraction-mystery&lt;/A&gt; for an example source&lt;/P&gt;</description>
      <pubDate>Tue, 07 Sep 2010 23:50:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45052#M10632</guid>
      <dc:creator>Ant1D</dc:creator>
      <dc:date>2010-09-07T23:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45053#M10633</link>
      <description>&lt;P&gt;You just need to use SOURCE_KEY in the transform.&lt;/P&gt;

&lt;P&gt;props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source-extract]
REPORT-sourcefield = source-transform

transform.conf:

[source-transform]
SOURCE_KEY = source
REGEX = .......
FORMAT = fieldname=$1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Mar 2011 22:54:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-Question/m-p/45053#M10633</guid>
      <dc:creator>wollinet</dc:creator>
      <dc:date>2011-03-09T22:54:13Z</dc:date>
    </item>
  </channel>
</rss>

