<?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 Extract Field from source's file path in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28505#M5652</link>
    <description>&lt;P&gt;Hi,
I would to know if it is possible to use a part of the source events file path ie "foobar" from&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/weblogs/123/https-blah.com/foobar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and extract it as a field or value (ie ws_server) in either a search or via transforms.conf / props.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jan 2011 13:57:12 GMT</pubDate>
    <dc:creator>pl123</dc:creator>
    <dc:date>2011-01-19T13:57:12Z</dc:date>
    <item>
      <title>Extract Field from source's file path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28505#M5652</link>
      <description>&lt;P&gt;Hi,
I would to know if it is possible to use a part of the source events file path ie "foobar" from&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/weblogs/123/https-blah.com/foobar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and extract it as a field or value (ie ws_server) in either a search or via transforms.conf / props.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2011 13:57:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28505#M5652</guid>
      <dc:creator>pl123</dc:creator>
      <dc:date>2011-01-19T13:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Field from source's file path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28506#M5653</link>
      <description>&lt;P&gt;For using it in a search, you can test it with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "https-blah.com/(?&amp;lt;path&amp;gt;\S*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Might have to adjust it, depending on what other values exist.&lt;/P&gt;

&lt;P&gt;After that, use field extractions.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2011 14:27:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28506#M5653</guid>
      <dc:creator>tedder</dc:creator>
      <dc:date>2011-01-19T14:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Field from source's file path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28507#M5654</link>
      <description>&lt;P&gt;Yes you can extract it to a field. If you want to search for it, you will want to use a indexed field (as opposed to a search time extracted field).&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
TRANSFORMS-extract-ws-server
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SOURCE_KEY = MetaData:Source
REGEX = /([^/]+)$
FORMAT = ws_server::$1
WRITE_META = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fields.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ws_server]
INDEXED = true
INDEXED_VALUE = false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Extracting a search-time field would be easier. Just specifing the extraction in props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
EXTRACt-ws = ^/([^/]+)$ in source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jan 2011 15:04:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28507#M5654</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2011-01-19T15:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Field from source's file path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28508#M5655</link>
      <description>&lt;P&gt;The Search-time field extraction with EXTRACT key works fine and it's usually recommended by Splunk.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2011 14:04:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Field-from-source-s-file-path/m-p/28508#M5655</guid>
      <dc:creator>marcoscala</dc:creator>
      <dc:date>2011-09-30T14:04:33Z</dc:date>
    </item>
  </channel>
</rss>

