<?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 using regex not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153917#M43226</link>
    <description>&lt;P&gt;Neither of these combinations is working. &lt;BR /&gt;
Thanks &lt;/P&gt;</description>
    <pubDate>Thu, 11 Jun 2015 14:35:06 GMT</pubDate>
    <dc:creator>ramighebral</dc:creator>
    <dc:date>2015-06-11T14:35:06Z</dc:date>
    <item>
      <title>Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153909#M43218</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am looking to extract a field from the raw event using the below regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.*&amp;lt;name&amp;gt;(?&amp;lt;parameter_name&amp;gt;[^\&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It should extract a string between 2 XML tags.&lt;BR /&gt;
The extraction is working fine using &lt;STRONG&gt;rex&lt;/STRONG&gt; command, when added to the Field extractions the extraction is not happening.&lt;BR /&gt;
The configuration is defined in the Search and reporting app with Global read permission:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;etc/apps/search/local/props.conf

[sourcetype]
EXTRACT-parameter_name = .*&amp;lt;name&amp;gt;(?P&amp;lt;parameter_name&amp;gt;[^&amp;lt;]+)
EXTRACT-parameter_value = .*&amp;lt;value&amp;gt;(?P&amp;lt;parameter_value&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note: other extractions are present in the same file and are working well&lt;/P&gt;

&lt;P&gt;Any ideas what could be the catch here?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 06:24:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153909#M43218</guid>
      <dc:creator>ramighebral</dc:creator>
      <dc:date>2015-06-11T06:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153910#M43219</link>
      <description>&lt;P&gt;Just to clarify, are there XML tags literally named &lt;CODE&gt;name&lt;/CODE&gt; and &lt;CODE&gt;value&lt;/CODE&gt; in your data, and you are searching the same set of events with rex and with the field extraction?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 06:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153910#M43219</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-11T06:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153911#M43220</link>
      <description>&lt;P&gt;The left angle bracket (&amp;lt;) is a special character in regular expressions. You should escape it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
 EXTRACT-parameter_name = .*\&amp;lt;name&amp;gt;(?P&amp;lt;parameter_name&amp;gt;[^&amp;lt;]+)
 EXTRACT-parameter_value = .*\&amp;lt;value&amp;gt;(?P&amp;lt;parameter_value&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think that should fix it. BTW, the regular expressions in extracts (and most other places in Splunk) are not anchored, so you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[sourcetype]
 EXTRACT-parameter_name = \&amp;lt;name&amp;gt;(?P&amp;lt;parameter_name&amp;gt;[^&amp;lt;]+)
 EXTRACT-parameter_value = \&amp;lt;value&amp;gt;(?P&amp;lt;parameter_value&amp;gt;[^&amp;lt;]+)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Jun 2015 06:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153911#M43220</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-11T06:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153912#M43221</link>
      <description>&lt;P&gt;correct, the tag names are name and value.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 06:42:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153912#M43221</guid>
      <dc:creator>ramighebral</dc:creator>
      <dc:date>2015-06-11T06:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153913#M43222</link>
      <description>&lt;P&gt;If I'm not mistaken, the angular bracket in the capturing group should be escaped as well.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 06:59:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153913#M43222</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-11T06:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153914#M43223</link>
      <description>&lt;P&gt;Your syntax is fine so I have to assume your RegEx does not match your data.  Typically this happens because of some whitespace that you did not notice is there.  You should validate your RegEx with a tool like &lt;CODE&gt;Expresso&lt;/CODE&gt; because I am sure that's where the problem is.&lt;/P&gt;

&lt;P&gt;I am assuming that you would ideally like to have the 1 value be the &lt;CODE&gt;name&lt;/CODE&gt; of your &lt;CODE&gt;field&lt;/CODE&gt; and the other value be the &lt;CODE&gt;value&lt;/CODE&gt; of your &lt;CODE&gt;field&lt;/CODE&gt; but that you didn't think this is possible, but it is.  Read all about it here:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/7320/given-two-fields-how-can-i-create-a-third-field-whose-name-is-the-first-value-and-whose-value-is-the-second.html"&gt;http://answers.splunk.com/answers/7320/given-two-fields-how-can-i-create-a-third-field-whose-name-is-the-first-value-and-whose-value-is-the-second.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 14:24:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153914#M43223</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-11T14:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153915#M43224</link>
      <description>&lt;P&gt;Although the angle brackets ("&amp;lt;&amp;gt;") do have a special meaning in naming capture groups, they do not need to be escaped; it is the question mark ("?") that marks the token that needs to be escaped.  So this cannot be the proble&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 14:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153915#M43224</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-11T14:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153916#M43225</link>
      <description>&lt;P&gt;Indeed I didn't know that was possible, but unfortunately this doesn't apply to my case.&lt;BR /&gt;
Thanks for the interesting share.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 14:34:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153916#M43225</guid>
      <dc:creator>ramighebral</dc:creator>
      <dc:date>2015-06-11T14:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153917#M43226</link>
      <description>&lt;P&gt;Neither of these combinations is working. &lt;BR /&gt;
Thanks &lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 14:35:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153917#M43226</guid>
      <dc:creator>ramighebral</dc:creator>
      <dc:date>2015-06-11T14:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153918#M43227</link>
      <description>&lt;P&gt;The other main thing to check is that your &lt;CODE&gt;sourcetype&lt;/CODE&gt; is correct.  When you say "others work" are they in the same stanza (under the same &lt;CODE&gt;[sourcetype]&lt;/CODE&gt; header?  If not, this could be your problem, especially if you have overriden your &lt;CODE&gt;sourcetype&lt;/CODE&gt;.   Using &lt;CODE&gt;btool&lt;/CODE&gt; can be very handy here.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 14:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153918#M43227</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-11T14:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153919#M43228</link>
      <description>&lt;P&gt;By others I mean other extractions defined in the same file but for different sourcetypes.&lt;BR /&gt;
Regarding your earlier comment for validating the regex; it works well with the rex command.&lt;BR /&gt;
This is a distributed environment, do you think it will make a difference if I define the extraction on th HF?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 14:48:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153919#M43228</guid>
      <dc:creator>ramighebral</dc:creator>
      <dc:date>2015-06-11T14:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153920#M43229</link>
      <description>&lt;P&gt;Agree: the angle brackets in the capture groups should &lt;EM&gt;not&lt;/EM&gt; be escaped.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:57:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153920#M43229</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-11T21:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153921#M43230</link>
      <description>&lt;P&gt;FYI, voting me down doesn't motivate me to research this further. &lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:58:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153921#M43230</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-11T21:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153922#M43231</link>
      <description>&lt;P&gt;Field extractions are search-time - this belongs on the search head, or wherever it is that users log-in to search.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:59:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153922#M43231</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-06-11T21:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153923#M43232</link>
      <description>&lt;P&gt;Oh, that's new to me. Thanks for sharing.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 05:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153923#M43232</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-12T05:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153924#M43233</link>
      <description>&lt;P&gt;He did not vote down your answer, I did.  Voting ( &lt;CODE&gt;up&lt;/CODE&gt; and &lt;CODE&gt;down&lt;/CODE&gt; ) is a responsibility that we all have even though it is expensive (lowers Karma).  I downvoted (with a very gentle correctionary comment), and also encouraging downvoting, for all of these reasons:&lt;BR /&gt;
1: It moves the incorrect answer to the bottom so people can focus on (potentially) correct answers and will not waste time on incorrect answers.&lt;BR /&gt;
2: It discourages people from posting answers that they should not (haven't tested, aren't sure, etc.).&lt;BR /&gt;
3: It hopefully educates the user who had the wrong answer (it was good for you).&lt;/P&gt;

&lt;P&gt;I have been downvoted many times and it was good for me almost every time.  I don't like being wrong, but I dislike being ignorant even more.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 14:47:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153924#M43233</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-12T14:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153925#M43234</link>
      <description>&lt;P&gt;@Woodcock its kind of unnecessary when the vote hasn't been upvoted or accepted. If so, the author of the question could still edit and fix the question, have a comment-dialogue with the asker, etc.&lt;/P&gt;

&lt;P&gt;In this case, there hasn't been any votes or acceptance, so its a bit preemptive. &lt;/P&gt;

&lt;P&gt;If there were 5 answers, and one of them is definitely better than the others, AND the incorrect one had been accepted, all your points start to make a bit more sense. &lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 15:43:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153925#M43234</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-06-12T15:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153926#M43235</link>
      <description>&lt;P&gt;That is why I &lt;CODE&gt;downvoted&lt;/CODE&gt; instead of &lt;CODE&gt;deleted&lt;/CODE&gt; the answer (which I could have done), which the author may still do, but I hope not because I referenced this thread as background in a new question:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/244111/proper-etiquette-and-timing-for-voting-here-on-ans.html"&gt;http://answers.splunk.com/answers/244111/proper-etiquette-and-timing-for-voting-here-on-ans.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 16:06:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153926#M43235</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-12T16:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153927#M43236</link>
      <description>&lt;P&gt;You could've deleted it? &lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 21:38:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153927#M43236</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-06-12T21:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions using regex not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153928#M43237</link>
      <description>&lt;P&gt;This is a privilege earned at the 2000-point &lt;CODE&gt;karma&lt;/CODE&gt; level:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunkbase/splunkbase/Answers/HowtoearnKarma#Karma_rewards"&gt;http://docs.splunk.com/Documentation/Splunkbase/splunkbase/Answers/HowtoearnKarma#Karma_rewards&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And before anyone says "No you can't", I would first have to convert the Answer to a Comment and then Delete the Comment.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 22:16:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-using-regex-not-working/m-p/153928#M43237</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-06-12T22:16:57Z</dc:date>
    </item>
  </channel>
</rss>

