<?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: extracting search fields using regexp in transforms.conf not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27799#M5437</link>
    <description>&lt;P&gt;You're looking at pretty old documentation. You're not &lt;EM&gt;really&lt;/EM&gt; using Splunk version 3.0.2, right?  All of the "bundles" stuff went out a long time ago and was replaced by "apps". Start &lt;A href="http://www.splunk.com/base/Documentation"&gt;here&lt;/A&gt; for the documentation, or use the "product version" dropdown in the upper left to make sure you're looking at something current.&lt;/P&gt;

&lt;P&gt;Putting it in etc/system/local is alright, though the more common place in Splunk 4.x would be in /etc/apps/search/local, or in a new app of your own creation.&lt;/P&gt;

&lt;P&gt;&lt;B&gt;Suggestions / Issues&lt;/B&gt;:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;The regex is a little off. You need &lt;CODE&gt;\S+&lt;/CODE&gt; (note the plus sign) to match more than one character.&lt;/LI&gt;
&lt;LI&gt;You can leave out the &lt;CODE&gt;$0&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Use &lt;CODE&gt;REPORT&lt;/CODE&gt; instead of &lt;CODE&gt;TRANSFORMS&lt;/CODE&gt; for search-time extraction, and make sure that the name referenced in props.conf matches the stanza name used in transforms.conf.&lt;/LI&gt;
&lt;LI&gt;DEST_KEY isn't needed&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;With those things in mind, &lt;B&gt;try this&lt;/B&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#transforms.conf
[get-rails-action-path]
REGEX = Started \S+ ([\S\/"\.]+)
FORMAT = rails-action-path::$1

#props.conf
[(?:::){0}*rails]
LINE_BREAKER = ([\r\n]).* [\r\n]+Started (POST|GET)
REPORT-rap = get-rails-action-path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Assuming your stanza name in props.conf is ok, since you say it's working for line breaker.)&lt;/P&gt;</description>
    <pubDate>Tue, 14 Jun 2011 22:34:19 GMT</pubDate>
    <dc:creator>southeringtonp</dc:creator>
    <dc:date>2011-06-14T22:34:19Z</dc:date>
    <item>
      <title>extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27798#M5436</link>
      <description>&lt;P&gt;I refered to the following documentation to try and get this working:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/3.0.2/Admin/CreateAdditionalSearchFields" target="_blank"&gt;http://www.splunk.com/base/Documentation/3.0.2/Admin/CreateAdditionalSearchFields&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I have a standard rails log file where every new request starts with a line like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Started (GET|POST) "/some-path"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to extract "/some-path" into a field rails-action-path. I added the following to $SPLUNK_HOME/etc/system/local/transforms.conf (note that the documentation says to add it to $SPLUNK_HOME/etc/bundles/local/transforms.conf, but there is no bundles directory in my installation and my other conf files have all been in the system directory).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[get-rails-action-path]
REGEX = Started \S ([\S\/"\.]+)
FORMAT = $0 rails-action-path::$1
DEST_KEY = _meta
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My sourcetype stanza for the rails logs in $SPLUNK_HOME/etc/apps/search/local/props.conf is as follows (again note, my props.conf has always lived here although the documentation refers to $SPLUNK_HOME/etc/bundles/local/props.conf).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[(?:::){0}*rails]
LINE_BREAKER = ([\r\n]).* [\r\n]+Started (POST|GET)
TRANSFORMS-rap = rails-action-path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that the last line was the only part I just added. The wildcard source type for the rails logs and the LINE_BREAKER have been there for awhile and behave as I expect.&lt;/P&gt;

&lt;P&gt;After restarting my indexer with these changes, I do not see rails-action-path in the field list.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27798#M5436</guid>
      <dc:creator>builder</dc:creator>
      <dc:date>2020-09-28T09:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27799#M5437</link>
      <description>&lt;P&gt;You're looking at pretty old documentation. You're not &lt;EM&gt;really&lt;/EM&gt; using Splunk version 3.0.2, right?  All of the "bundles" stuff went out a long time ago and was replaced by "apps". Start &lt;A href="http://www.splunk.com/base/Documentation"&gt;here&lt;/A&gt; for the documentation, or use the "product version" dropdown in the upper left to make sure you're looking at something current.&lt;/P&gt;

&lt;P&gt;Putting it in etc/system/local is alright, though the more common place in Splunk 4.x would be in /etc/apps/search/local, or in a new app of your own creation.&lt;/P&gt;

&lt;P&gt;&lt;B&gt;Suggestions / Issues&lt;/B&gt;:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;The regex is a little off. You need &lt;CODE&gt;\S+&lt;/CODE&gt; (note the plus sign) to match more than one character.&lt;/LI&gt;
&lt;LI&gt;You can leave out the &lt;CODE&gt;$0&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Use &lt;CODE&gt;REPORT&lt;/CODE&gt; instead of &lt;CODE&gt;TRANSFORMS&lt;/CODE&gt; for search-time extraction, and make sure that the name referenced in props.conf matches the stanza name used in transforms.conf.&lt;/LI&gt;
&lt;LI&gt;DEST_KEY isn't needed&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;With those things in mind, &lt;B&gt;try this&lt;/B&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#transforms.conf
[get-rails-action-path]
REGEX = Started \S+ ([\S\/"\.]+)
FORMAT = rails-action-path::$1

#props.conf
[(?:::){0}*rails]
LINE_BREAKER = ([\r\n]).* [\r\n]+Started (POST|GET)
REPORT-rap = get-rails-action-path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(Assuming your stanza name in props.conf is ok, since you say it's working for line breaker.)&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2011 22:34:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27799#M5437</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-06-14T22:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27800#M5438</link>
      <description>&lt;P&gt;I'm going to have to reply in two comments since it has a comment limit.&lt;/P&gt;

&lt;P&gt;You are correct, I am using 4.2.1. I didn't notice the documentation was old. Sorry about that.&lt;/P&gt;

&lt;P&gt;The missing + on the regexp and the non-matching stanza name were both just brain farts on my part, but I probably wouldn't have caught them after staring at this for so long.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2011 23:33:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27800#M5438</guid>
      <dc:creator>builder</dc:creator>
      <dc:date>2011-06-14T23:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27801#M5439</link>
      <description>&lt;P&gt;I updated the conf files per the above and restarted my indexer. Now, rails-action-path shows up on my summary page as a field with properly parsed values. If I click on the field and select 'show only events with this field', it does the right thing (searching with sourcetype="space-rails" rails_action_path="*" and showing numerous events). However, if I select any specific listed value for the field (e.g., searching with sourcetype="space-rails" rails_action_path="/client_api/updateGameData"), it returns 0 events and says "Waiting for data" indefinitely.&lt;/P&gt;

&lt;P&gt;What could be going on here?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:40:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27801#M5439</guid>
      <dc:creator>builder</dc:creator>
      <dc:date>2020-09-28T09:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27802#M5440</link>
      <description>&lt;P&gt;So, I was reading over the 4.2.1 docs, per your advisement, and it sounds like the recommendation is actually search-time field extraction. Thus, I have reverted all the changes mentioned in this thread to my transform.conf and props.conf on my indexer machines. I have instead set up search-time extraction in my props.conf, but it's not working either (the field is back to not showing up). I will start a new thread for that.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2011 00:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27802#M5440</guid>
      <dc:creator>builder</dc:creator>
      <dc:date>2011-06-15T00:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27803#M5441</link>
      <description>&lt;P&gt;Using REPORT as above, it will be a search-time transaction. DEST_KEY shouldn't be in there though; I copied and pasted from your example and failed to remove it until just now.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2011 01:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27803#M5441</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-06-15T01:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27804#M5442</link>
      <description>&lt;P&gt;Not sure why it wouldn't show up and say "waiting for events", unless having DEST_KEY in there was interfering with things, which is quite possible.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2011 01:20:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27804#M5442</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2011-06-15T01:20:21Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27805#M5443</link>
      <description>&lt;P&gt;I was using the instructions here for search time extraction and EXTRACT seemed simpler:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.splunk.com/base/Documentation/4.2.1/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles" target="_blank"&gt;http://www.splunk.com/base/Documentation/4.2.1/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also, the original confs were on my indexer. The EXTRACT is in props.conf on my search-head. The field is showing up using this method, but it didn't solve the problem. It's pretty much the same as before. I see the field and all extracted values. If I search by rails_action_path="*", I get all results, but any specific value returns 0 results/No matching events found.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27805#M5443</guid>
      <dc:creator>builder</dc:creator>
      <dc:date>2020-09-28T09:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: extracting search fields using regexp in transforms.conf not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27806#M5444</link>
      <description>&lt;P&gt;Just going to start a new thread as this one seems to have died. : P&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2011 17:44:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extracting-search-fields-using-regexp-in-transforms-conf-not/m-p/27806#M5444</guid>
      <dc:creator>builder</dc:creator>
      <dc:date>2011-06-16T17:44:33Z</dc:date>
    </item>
  </channel>
</rss>

