<?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 Certain REGEX strings in transforms.conf will fail in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Certain-REGEX-strings-in-transforms-conf-will-fail/m-p/20743#M3293</link>
    <description>&lt;P&gt;I have requierement where i need to route data from certain sources to a specific index. The index name will be extracted from a specific location in the path when it's only preceded by a certain other segment. Example (this is a windows box - notice the path separators):&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[send_to_index]&lt;BR /&gt;
REGEX = bar\\[[:alnum::]]\\&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In this case I need to extract the path segment that comes after &lt;CODE&gt;bar&lt;/CODE&gt; and send that path's data to the index with extract's name. The setup is simple and should work but it doesn't. &lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2011 15:37:02 GMT</pubDate>
    <dc:creator>_d_</dc:creator>
    <dc:date>2011-11-22T15:37:02Z</dc:date>
    <item>
      <title>Certain REGEX strings in transforms.conf will fail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Certain-REGEX-strings-in-transforms-conf-will-fail/m-p/20743#M3293</link>
      <description>&lt;P&gt;I have requierement where i need to route data from certain sources to a specific index. The index name will be extracted from a specific location in the path when it's only preceded by a certain other segment. Example (this is a windows box - notice the path separators):&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[send_to_index]&lt;BR /&gt;
REGEX = bar\\[[:alnum::]]\\&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In this case I need to extract the path segment that comes after &lt;CODE&gt;bar&lt;/CODE&gt; and send that path's data to the index with extract's name. The setup is simple and should work but it doesn't. &lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 15:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Certain-REGEX-strings-in-transforms-conf-will-fail/m-p/20743#M3293</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-11-22T15:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Certain REGEX strings in transforms.conf will fail</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Certain-REGEX-strings-in-transforms-conf-will-fail/m-p/20744#M3294</link>
      <description>&lt;P&gt;After some careful exploration I have an answer that might benefit the community. The short answer is "do not end your REGEX in backslash".&lt;BR /&gt;
A &lt;CODE&gt;btool --debug&lt;/CODE&gt; for the above gives the following:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;splunk cmd btool --debug transforms list send_to_index&lt;BR /&gt;
system     [send_to_index]&lt;BR /&gt;
system     CAN_OPTIMIZE = True&lt;BR /&gt;
system     CLEAN_KEYS = True&lt;BR /&gt;
system     DEFAULT_VALUE = &lt;BR /&gt;
system     DEST_KEY = &lt;BR /&gt;
system     FORMAT = indexQueue&lt;BR /&gt;
system     KEEP_EMPTY_VALS = False&lt;BR /&gt;
system     LOOKAHEAD = 4096&lt;BR /&gt;
system     MV_ADD = False&lt;BR /&gt;
system     REGEX = bar\\[[:alnum:]]\&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
system     SOURCE_KEY = _raw&lt;BR /&gt;
system     WRITE_META = False&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You clearly can see that DEST_KEY is not considered by the system and consequently the setup fails. The culprit behind this appears to be that last backslash. &lt;BR /&gt;
It turns out that in .conf files the presence of a backslash at the end of a line will escape the implied newline there. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Easy Fix&lt;/STRONG&gt;  - do &lt;STRONG&gt;NOT&lt;/STRONG&gt; end the REGEX with backslash: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[send_to_index]&lt;BR /&gt;
REGEX = bar\\[[:alnum::]]\\\w+&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;OR, if you need a backslash there, escape it and bracket it.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[send_to_index]&lt;BR /&gt;
REGEX = bar\\[[:alnum::]][\\]&lt;BR /&gt;
DEST_KEY = queue&lt;BR /&gt;
FORMAT = indexQueue&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 15:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Certain-REGEX-strings-in-transforms-conf-will-fail/m-p/20744#M3294</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-11-22T15:37:48Z</dc:date>
    </item>
  </channel>
</rss>

