<?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 How to extract mixed data content from an event (XML and REGEX)? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326585#M21121</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I am facing a problem I can not seem to solve:&lt;/P&gt;

&lt;P&gt;I've got events of this kind:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[2017-07-21 11:06:44,007] INFO text text text text more text and text and more text: [&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt; ... XML CONTENT]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am able to extract the interesting fields in the first part, but then I want to also be able to extract the XML from the second part...&lt;/P&gt;

&lt;P&gt;I know we can extract the XML part in a field and use it with spath, the problem being you've got all this happening in the search bar.. I would like to know if there is anything I could do in the props.conf so everything get extracted automatically and available when searching the data in the interface?&lt;/P&gt;

&lt;P&gt;I tried to define:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; EXTRACT-example = &amp;lt;REGEX HERE&amp;gt;
KV_MODE=XML
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thinking maybe it would extract what matches the regex and then use the KV_MODE to extract the second part with XML but... no luck.&lt;/P&gt;

&lt;P&gt;Any idea on how I could achieve this please?&lt;/P&gt;

&lt;P&gt;Thanks guys!&lt;/P&gt;

&lt;P&gt;Laurent&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jul 2017 10:31:51 GMT</pubDate>
    <dc:creator>llacoste</dc:creator>
    <dc:date>2017-07-21T10:31:51Z</dc:date>
    <item>
      <title>How to extract mixed data content from an event (XML and REGEX)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326585#M21121</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;I am facing a problem I can not seem to solve:&lt;/P&gt;

&lt;P&gt;I've got events of this kind:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[2017-07-21 11:06:44,007] INFO text text text text more text and text and more text: [&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt; ... XML CONTENT]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am able to extract the interesting fields in the first part, but then I want to also be able to extract the XML from the second part...&lt;/P&gt;

&lt;P&gt;I know we can extract the XML part in a field and use it with spath, the problem being you've got all this happening in the search bar.. I would like to know if there is anything I could do in the props.conf so everything get extracted automatically and available when searching the data in the interface?&lt;/P&gt;

&lt;P&gt;I tried to define:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; EXTRACT-example = &amp;lt;REGEX HERE&amp;gt;
KV_MODE=XML
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thinking maybe it would extract what matches the regex and then use the KV_MODE to extract the second part with XML but... no luck.&lt;/P&gt;

&lt;P&gt;Any idea on how I could achieve this please?&lt;/P&gt;

&lt;P&gt;Thanks guys!&lt;/P&gt;

&lt;P&gt;Laurent&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 10:31:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326585#M21121</guid>
      <dc:creator>llacoste</dc:creator>
      <dc:date>2017-07-21T10:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract mixed data content from an event (XML and REGEX)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326586#M21122</link>
      <description>&lt;P&gt;hi llacoste,&lt;BR /&gt;
try with something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.*\[(?&amp;lt;xml_field&amp;gt;\&amp;lt;\?xml version[^\]]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 11:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326586#M21122</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-07-21T11:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract mixed data content from an event (XML and REGEX)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326587#M21123</link>
      <description>&lt;P&gt;Hi, thanks for your answer,&lt;/P&gt;

&lt;P&gt;However that would only extract the xml part. But the full xml part without breaking down each "sub fields".&lt;/P&gt;

&lt;P&gt;I have already extracted the full xml part in a field but after that I need to use spath from the search bar. That's not what I am looking for, I want to make splunk extract each sub fields from the XML alone.&lt;/P&gt;

&lt;P&gt;Hope it makes sense...&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 11:13:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326587#M21123</guid>
      <dc:creator>llacoste</dc:creator>
      <dc:date>2017-07-21T11:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract mixed data content from an event (XML and REGEX)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326588#M21124</link>
      <description>&lt;P&gt;Why do you need the fields extracted at index time? Splunk best practice is to do that at search time. You can create a Field Extraction for search time field extractions that is more flexible than the index time field extraction very easily, either using the field extraction tool, or just through the Settings -&amp;gt; Fields -&amp;gt; Field Extraction menus way. Either one works great. If you are good with regular expressions, you should have no problem. If you aren't, the field extraction tool may be your best bet.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 12:15:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326588#M21124</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-07-21T12:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract mixed data content from an event (XML and REGEX)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326589#M21125</link>
      <description>&lt;P&gt;Well, in fact I am not going for index time extraction but search time extraction. The props.conf is in the Search Head app. &lt;BR /&gt;
I know it is a best practice not to use the index time extraction if I can avoid. &lt;/P&gt;

&lt;P&gt;Using the GUI field extraction feature would not achieve what I am trying to do here, because I could extract everything with regex manually... but I was wondering if we could let splunk make the hard work by using some kind of spath or kv_mode=xml inside the props.conf...&lt;BR /&gt;
Hope that clarifies my need, thanks for your answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 12:24:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326589#M21125</guid>
      <dc:creator>llacoste</dc:creator>
      <dc:date>2017-07-21T12:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract mixed data content from an event (XML and REGEX)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326590#M21126</link>
      <description>&lt;P&gt;Have the "xml part" extracted into a field and then use the &lt;CODE&gt;spath&lt;/CODE&gt; and/or &lt;CODE&gt;xmlkv&lt;/CODE&gt; commands on that field in your SPL.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2017 02:20:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326590#M21126</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-23T02:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract mixed data content from an event (XML and REGEX)?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326591#M21127</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Thanks for the advice.&lt;BR /&gt;
You're right, that's what I was going to do and what I've been answered already in this thread. However, as explained I was trying to do everything without using the spath or xmlkv in the SPL if that makes sense. I don't want to overload my searches or dashboards. I wanted the users to be able to have those fields extracted for them whenever they need to use the SPL. &lt;/P&gt;

&lt;P&gt;So I was hoping Splunk could be really clever and make both extraction at the same time in the props.conf &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What do you think?&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jul 2017 20:20:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-extract-mixed-data-content-from-an-event-XML-and-REGEX/m-p/326591#M21127</guid>
      <dc:creator>llacoste</dc:creator>
      <dc:date>2017-07-23T20:20:32Z</dc:date>
    </item>
  </channel>
</rss>

