<?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: Extract fields from XML tags in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450033#M171377</link>
    <description>&lt;P&gt;Hello again,&lt;/P&gt;

&lt;P&gt;I finally found other solution for which my regex works great.&lt;BR /&gt;
I made a dedicated config only for my Antivirus Servers and in my "input.conf" I gave to the "renderXml" option the "false" value in order to receive my log in plain text.&lt;/P&gt;

&lt;P&gt;Now I can extract everything I need.&lt;/P&gt;

&lt;P&gt;Thank you again.&lt;BR /&gt;
Michail&lt;/P&gt;</description>
    <pubDate>Thu, 09 May 2019 16:27:48 GMT</pubDate>
    <dc:creator>mvagionakis</dc:creator>
    <dc:date>2019-05-09T16:27:48Z</dc:date>
    <item>
      <title>Extract fields from XML tags</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450029#M171373</link>
      <description>&lt;P&gt;Hello Splunkers,&lt;/P&gt;

&lt;P&gt;I searched to find the answer but I couldn't find the solution in answers.com.&lt;BR /&gt;
I'm sorry if my research wasn't good enough and the answer exist already.&lt;/P&gt;

&lt;P&gt;I want to send logs of OFFICESCAN in splunk and the only ways is through the windows event logs.&lt;BR /&gt;
So the format is an XML and so a lot of important fields are not extracted.&lt;/P&gt;

&lt;P&gt;Below an example of my log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'&amp;gt;&amp;lt;System&amp;gt;&amp;lt;Provider Name='Serveur Trend Micro OfficeScan'/&amp;gt;&amp;lt;EventID Qualifiers='49157'&amp;gt;500&amp;lt;/EventID&amp;gt;&amp;lt;Level&amp;gt;3&amp;lt;/Level&amp;gt;&amp;lt;Task&amp;gt;5&amp;lt;/Task&amp;gt;&amp;lt;Keywords&amp;gt;0x80000000000000&amp;lt;/Keywords&amp;gt;&amp;lt;TimeCreated SystemTime='2019-05-09T07:36:32.451876000Z'/&amp;gt;&amp;lt;EventRecordID&amp;gt;134998&amp;lt;/EventRecordID&amp;gt;&amp;lt;Channel&amp;gt;Application&amp;lt;/Channel&amp;gt;&amp;lt;Computer&amp;gt;myserver.dom&amp;lt;/Computer&amp;gt;&amp;lt;Security UserID='S-1-5-18'/&amp;gt;&amp;lt;/System&amp;gt;&amp;lt;EventData&amp;gt;&amp;lt;Data&amp;gt;Virus/programme malveillant : TrojanSpy.Win32.NEGASTEAL.THDCOAI Ordinateur : infected_server Domaine : xxx\yyy_toto_20h\ Fichier : C:\xxxxxx\yyyyyyy-zzzzzzzz\AppData\Local\Temp\yyyyyyyy_892E\blabla blabla(~174 KB).rar (blablalbla(~174 KB).exe) Date/heure : 09/05/2019 09:36:06 Résultat : Quarantaine &amp;lt;/Data&amp;gt;&amp;lt;/EventData&amp;gt;&amp;lt;/Event&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I need is between the  that is to say the values like "fichier", "Résultat" etc.&lt;/P&gt;

&lt;P&gt;When I'm testing my regex command sur &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; the command is working well but once in splunk it doesn't work anymore.&lt;BR /&gt;
For exemple I tried this command in order to extract the "domaine" value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Domaine\s\:\s(?P&amp;lt;Domaine&amp;gt;([^\s]+))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried in splunk to use the  "| xmlkv" function but it only extracts the "data" content but not the fields contained in it; I think it is a normal behaviour. &lt;/P&gt;

&lt;P&gt;So, I suppose that I need a specific command to do this extraction, or I missing something in my regex.&lt;/P&gt;

&lt;P&gt;Do you have any suggestion please?&lt;/P&gt;

&lt;P&gt;I thank you in advance.&lt;/P&gt;

&lt;P&gt;have a great day.&lt;BR /&gt;
Michail&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 08:21:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450029#M171373</guid>
      <dc:creator>mvagionakis</dc:creator>
      <dc:date>2019-05-09T08:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from XML tags</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450030#M171374</link>
      <description>&lt;P&gt;Hi mvagionakis,&lt;/P&gt;

&lt;P&gt;mon français n'est pas très bon, but I try my best &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;You can create a dynamic extraction using props.conf and transforms.conf like this; first add a props.conf stanza to match your sourcetype:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[le type de source d'analyse de bureau]
REPORT-001_mon-entrée-uniq-ici = extraireDesPairesDeValeursDeClésDynamiques
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;next you need to configure a transforms.conf stanza:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extraireDesPairesDeValeursDeClésDynamiques]
REGEX = \&amp;lt;(\w+)\&amp;gt;([^\&amp;lt;]+)\&amp;lt;
FORMAT = $1::$2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this will create a dynamic search time extraction of the XML tags as field and their value.&lt;/P&gt;

&lt;P&gt;You must excuse my for trying to add some french to the answer, it might not have worked out in the end but check this answer &lt;A href="https://answers.splunk.com/answers/319646/how-to-write-the-regex-to-extract-data-inside-squa.html"&gt;https://answers.splunk.com/answers/319646/how-to-write-the-regex-to-extract-data-inside-squa.html&lt;/A&gt; to get an idea how it is done &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps anyway ...&lt;/P&gt;

&lt;P&gt;à votre santé, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 08:40:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450030#M171374</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-05-09T08:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from XML tags</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450031#M171375</link>
      <description>&lt;P&gt;ou peut-être j'appelle @yannK pour aider &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 08:43:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450031#M171375</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-05-09T08:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from XML tags</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450032#M171376</link>
      <description>&lt;P&gt;Hello Mus,&lt;/P&gt;

&lt;P&gt;Merci beaucoup pour ton retour.&lt;/P&gt;

&lt;P&gt;I've already tried these solutions but it doesn't work.&lt;/P&gt;

&lt;P&gt;thank you for your prompt reply.&lt;BR /&gt;
Michail&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 10:33:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450032#M171376</guid>
      <dc:creator>mvagionakis</dc:creator>
      <dc:date>2019-05-09T10:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from XML tags</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450033#M171377</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;

&lt;P&gt;I finally found other solution for which my regex works great.&lt;BR /&gt;
I made a dedicated config only for my Antivirus Servers and in my "input.conf" I gave to the "renderXml" option the "false" value in order to receive my log in plain text.&lt;/P&gt;

&lt;P&gt;Now I can extract everything I need.&lt;/P&gt;

&lt;P&gt;Thank you again.&lt;BR /&gt;
Michail&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 16:27:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450033#M171377</guid>
      <dc:creator>mvagionakis</dc:creator>
      <dc:date>2019-05-09T16:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extract fields from XML tags</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450034#M171378</link>
      <description>&lt;P&gt;Mordiou!, I would be surprised that apostrophes and accents are allowed in stanza names : )&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 18:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-fields-from-XML-tags/m-p/450034#M171378</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2019-05-09T18:49:14Z</dc:date>
    </item>
  </channel>
</rss>

