<?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 Extractions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11934#M882</link>
    <description>&lt;P&gt;Thanks I will try this - I have already been using rex to test my regex which is why i assumed it was probably a syntax issue rather than a regex issue!&lt;/P&gt;</description>
    <pubDate>Wed, 21 Apr 2010 22:08:26 GMT</pubDate>
    <dc:creator>Hazel</dc:creator>
    <dc:date>2010-04-21T22:08:26Z</dc:date>
    <item>
      <title>Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11932#M880</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to configure a props/transforms and it is not working.  it does not come up as an extra field that i can select on the web search.&lt;/P&gt;

&lt;P&gt;Can you see anything wrong with this? &lt;/P&gt;

&lt;P&gt;The path i am extracting from looks something like /app/ems/envs/U1_LN_DERIV_TMS/logs/trace.log&lt;/P&gt;

&lt;P&gt;I want to pick up the directory name in the middle - U1_LN_DERIV_TMS.&lt;/P&gt;

&lt;P&gt;I even tried changing my regex to (.*) to see if there was a problem with the regex (which i have tested in the splunk web and worked fine) and it still doesn't come through. &lt;/P&gt;

&lt;P&gt;Have i missed something obvious? Have also tried it with and without the quotes around the REGEX&lt;/P&gt;

&lt;PRE&gt;
props.conf:

[source::///app/ems/envs/uat/.../logs/trace.log]
REPORT-ems = instanceName

transforms.conf

[instanceName]
SOURCE_KEY = source
REGEX=\/app\/ems\/envs\/uat\/([A-Z0-9_]*)\/logs\/trace.log
FORMAT = emsinstance::$1
&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Apr 2010 21:22:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11932#M880</guid>
      <dc:creator>Hazel</dc:creator>
      <dc:date>2010-04-21T21:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11933#M881</link>
      <description>&lt;P&gt;Too many slashes at the beginning of &lt;CODE&gt;[source:///...]&lt;/CODE&gt;. The extra slashes are only used (rather unnecessarily anyway) in inputs.conf stanzas, not props.conf.&lt;/P&gt;

&lt;P&gt;Also, you can test regexes at the CLI directly using the &lt;CODE&gt;| rex&lt;/CODE&gt; search command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=source "/app/ems/envs/uat/(?&amp;lt;emsinstance&amp;gt;\w*)/logs/trace.log"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Apr 2010 21:50:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11933#M881</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-04-21T21:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11934#M882</link>
      <description>&lt;P&gt;Thanks I will try this - I have already been using rex to test my regex which is why i assumed it was probably a syntax issue rather than a regex issue!&lt;/P&gt;</description>
      <pubDate>Wed, 21 Apr 2010 22:08:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11934#M882</guid>
      <dc:creator>Hazel</dc:creator>
      <dc:date>2010-04-21T22:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extractions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11935#M883</link>
      <description>&lt;P&gt;gkanapathy is right about your problem is.  I just had a few thoughts that wouldn't fit in a comment.&lt;/P&gt;

&lt;P&gt;Just so you know, you can use named capture groups, like &lt;CODE&gt;(?&amp;lt;emsinstance&amp;gt;\w+)&lt;/CODE&gt; in your &lt;CODE&gt;transforms.conf&lt;/CODE&gt; file just like you do using &lt;CODE&gt;rex&lt;/CODE&gt;.  When your using named groups, you don't need the &lt;CODE&gt;FORMAT&lt;/CODE&gt; line anymore.  I found that this approach makes it quicker to jump between interactive testing with &lt;CODE&gt;rex&lt;/CODE&gt; and then copying the regex into my &lt;CODE&gt;transforms.conf&lt;/CODE&gt; file.&lt;/P&gt;

&lt;P&gt;In this case, you also have the option of using an &lt;CODE&gt;EXTRACT&lt;/CODE&gt; entry in your &lt;CODE&gt;props.conf&lt;/CODE&gt; file.  I rather prefer this approach, since you can setup everything in one place, and you don't to come up with some arbitrary name transformer name.  &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Here's an example in &lt;CODE&gt;props.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;
[source::/app/ems/envs/uat/*/logs/trace.log]
EXTRACT-fields = [/\\]uat[/\\](?[\w_]+)[/\\]logs[/\\] in source

&lt;/PRE&gt;

&lt;P&gt;&lt;EM&gt;Notes:&lt;/EM&gt;  I use &lt;CODE&gt;[/\\]&lt;/CODE&gt; because it will match both unix-style and dos-style paths (if that's a concern for you and you can use that in your source config entry too, although it looks ugly:  &lt;CODE&gt;[source::[/\\]app[/\\]ems[/\\]envs[/\\]uat[/\\]*[/\\]logs[/\\]trace.log]&lt;/CODE&gt;).  You may also note that I'm not matching the whole path in the regex, which is because in this case, you really don't need to, your &lt;CODE&gt;[source::...]&lt;/CODE&gt; stanza is doing that work for you already.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2010 02:00:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extractions/m-p/11935#M883</guid>
      <dc:creator>Lowell</dc:creator>
      <dc:date>2010-04-29T02:00:10Z</dc:date>
    </item>
  </channel>
</rss>

