<?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: How to write the regex to extract a field from XML data if the field is not completely XML? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213392#M62590</link>
    <description>&lt;P&gt;Try this, assuming preName is the name you want for that field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"implementationName&amp;gt;(?&amp;lt;preName&amp;gt;w+)&amp;lt;"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 04 Jan 2016 23:59:50 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-01-04T23:59:50Z</dc:date>
    <item>
      <title>How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213389#M62587</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;I have a field which I would like to extract a field from the XML being displayed.  The only problem is the field is not completely XML.  I am not allowed to post an example, but basically I want to extract something that looks like: &lt;/P&gt;

&lt;P&gt;Event xml &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8" standalone="yes"&amp;gt;&amp;lt;ns2:behaviorVersion&amp;gt;0&amp;lt;/ns2:behaviorVersion&amp;gt;&amp;lt;triggers&amp;gt;&amp;lt;channelId&amp;gt;0055&amp;lt;/channelId&amp;gt;&amp;lt;clientVersion&amp;gt;3&amp;lt;/clientVersion&amp;gt;&amp;lt;/triggers&amp;gt;&amp;lt;eventInfo&amp;gt;&amp;lt;bos:instanceId&amp;gt;000121481&amp;lt;/bos:instanceId&amp;gt;&amp;lt;bos:serverName&amp;gt;1&amp;lt;/bos:serverName&amp;gt;&amp;lt;bos:implementationName&amp;gt;TransferStarted&amp;lt;/bos:implementationName&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I would like to grab &lt;STRONG&gt;TransferStarted&lt;/STRONG&gt; in between the two tags &amp;lt;bos:implementationName&amp;gt; and &amp;lt;/bos:implementationName&amp;gt;.&lt;/P&gt;

&lt;P&gt;I have worked with regex in the past, but am still not confident.  Any help would be much appreciated and Happy New Year!&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 22:19:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213389#M62587</guid>
      <dc:creator>jameskerivan</dc:creator>
      <dc:date>2016-01-04T22:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213390#M62588</link>
      <description>&lt;P&gt;Have you tried this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;implementationName\&amp;gt;(\w+)\&amp;lt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jan 2016 23:14:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213390#M62588</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-04T23:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213391#M62589</link>
      <description>&lt;P&gt;Yes this is what I want.  Right now I am doing &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base query | rex field=F "(?.*)implementationName\&amp;gt;(\w+)\&amp;lt;" | stats count by preName | sort count desc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this is providing me with everything before implementationName as I specified.  How would I extract that field?  The way I see the regex working is it matches implementationName and looks for the characters &amp;gt; &amp;lt; for opening and closing of the value I want.  Do I need to specify a variable for that value?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 23:44:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213391#M62589</guid>
      <dc:creator>jameskerivan</dc:creator>
      <dc:date>2016-01-04T23:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213392#M62590</link>
      <description>&lt;P&gt;Try this, assuming preName is the name you want for that field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"implementationName&amp;gt;(?&amp;lt;preName&amp;gt;w+)&amp;lt;"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Jan 2016 23:59:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213392#M62590</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-04T23:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213393#M62591</link>
      <description>&lt;P&gt;There should be a backslash before "w+"&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 00:00:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213393#M62591</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-05T00:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213394#M62592</link>
      <description>&lt;P&gt;So the stats that it gives me is very confusing.  Here is my query :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base query | rex field=F "implementationName&amp;gt;(?&amp;lt;preName&amp;gt;\w+)&amp;lt;" | stats count by preName | sort count desc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is giving me a very small amount of the implemenationNames but it does not give them all.  For example TransferStarted did not get counted in my stats but if I look in the events I can see it.  Am I missing something?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 00:44:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213394#M62592</guid>
      <dc:creator>jameskerivan</dc:creator>
      <dc:date>2016-01-05T00:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213395#M62593</link>
      <description>&lt;P&gt;If there is more than 1 occurrence of the preName in one event, you should add &lt;CODE&gt;max_match=0&lt;/CODE&gt; to the &lt;CODE&gt;rex&lt;/CODE&gt; command and used &lt;CODE&gt;multi-value&lt;/CODE&gt; functions to get the right result&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 00:58:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213395#M62593</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-01-05T00:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to write the regex to extract a field from XML data if the field is not completely XML?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213396#M62594</link>
      <description>&lt;P&gt;Thank you very much.  You have been so helpful.  The problem I am coming across is with the way we are logging.  Your query is correct!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 20:12:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-the-regex-to-extract-a-field-from-XML-data-if-the/m-p/213396#M62594</guid>
      <dc:creator>jameskerivan</dc:creator>
      <dc:date>2016-01-05T20:12:06Z</dc:date>
    </item>
  </channel>
</rss>

