<?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: transform XML with same node name and add field names in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671876#M230217</link>
    <description>&lt;P&gt;Hey, that SPL is good. But it have 99 Data section and getting Regex backlag errors on Regex101.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I make it like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[test_xmldata_to_fields]
SOURCE_KEY = EventData_Xml
REGEX = (?ms)&amp;lt;Data&amp;gt;(.*?)&amp;lt;\/Data&amp;gt;
FORMAT = test_data::$1
MV_ADD = 1&lt;/LI-CODE&gt;&lt;P&gt;And then (dirty one, but it's working for start)&lt;BR /&gt;EVAL-t_process_name=mvindex(test_data,0)&lt;BR /&gt;EVAL-t_signature_name=mvindex(test_data,1)&lt;BR /&gt;EVAL-t_binary_description=mvindex(test_data,2)&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regarding the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;Data&amp;gt; field, d&lt;/SPAN&gt;&lt;SPAN&gt;oes it always have the same format (&lt;/SPAN&gt;&lt;SPAN&gt;process_name,&amp;nbsp;signature_name,binary_description)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* Yes&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sourcetype, I create my own and just using Splunk_TA_Windows for initial report to extract Data_Xml. Basically, it's new Sourcetype and can do transform, props as I like.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 09:43:04 GMT</pubDate>
    <dc:creator>jbanAtSplunk</dc:creator>
    <dc:date>2023-12-14T09:43:04Z</dc:date>
    <item>
      <title>transform XML with same node name and add field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671723#M230156</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have Windows Event for specific application that have payload in Windows Event Log, when using Splunk_TA_windows to extract data will get field with multipe "Data".&lt;/P&gt;
&lt;P&gt;&amp;lt;Data&amp;gt;process_name&amp;lt;/Data&amp;gt;&amp;lt;Data&amp;gt;signature_name&amp;lt;/Data&amp;gt;&amp;lt;Data&amp;gt;binary_description&amp;lt;/Data&amp;gt;&lt;BR /&gt;&lt;BR /&gt;How can I extract it automatically to fields/value:&lt;BR /&gt;process_name = process_name&lt;BR /&gt;signature = signature_name&lt;BR /&gt;binary = binary_description&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any way without using "big" regex? to just $1:$2:$3.. and then add names to $1, $2, $3 like for CSV.&lt;/P&gt;
&lt;P&gt;something like:&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;REGEX = (?ms)&amp;lt;Data&amp;gt;(.*?)&amp;lt;\/Data&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;this will create maybe one multi value field and then assign Field_name&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:18:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671723#M230156</guid>
      <dc:creator>jbanAtSplunk</dc:creator>
      <dc:date>2023-12-13T15:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: transform XML with same node name and add field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671862#M230213</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;What is the sourcetype applied by splunk? Also can you paste an complete event?&lt;/P&gt;&lt;P&gt;Regarding the&amp;nbsp;&lt;SPAN&gt;&amp;lt;Data&amp;gt; field, d&lt;/SPAN&gt;oes it always have the same format (&lt;SPAN&gt;process_name,&amp;nbsp;signature_name,binary_description)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe to start you could try this on spl:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "&amp;lt;Data&amp;gt;(?&amp;lt;process_name&amp;gt;.*)&amp;lt;\/Data&amp;gt;&amp;lt;Data&amp;gt;(?&amp;lt;signature_name&amp;gt;.*)&amp;lt;\/Data&amp;gt;&amp;lt;Data&amp;gt;(?&amp;lt;binary_description&amp;gt;.*)&amp;lt;\/Data&amp;gt;"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 08:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671862#M230213</guid>
      <dc:creator>glc_slash_it</dc:creator>
      <dc:date>2023-12-14T08:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: transform XML with same node name and add field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671876#M230217</link>
      <description>&lt;P&gt;Hey, that SPL is good. But it have 99 Data section and getting Regex backlag errors on Regex101.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I make it like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[test_xmldata_to_fields]
SOURCE_KEY = EventData_Xml
REGEX = (?ms)&amp;lt;Data&amp;gt;(.*?)&amp;lt;\/Data&amp;gt;
FORMAT = test_data::$1
MV_ADD = 1&lt;/LI-CODE&gt;&lt;P&gt;And then (dirty one, but it's working for start)&lt;BR /&gt;EVAL-t_process_name=mvindex(test_data,0)&lt;BR /&gt;EVAL-t_signature_name=mvindex(test_data,1)&lt;BR /&gt;EVAL-t_binary_description=mvindex(test_data,2)&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regarding the&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;Data&amp;gt; field, d&lt;/SPAN&gt;&lt;SPAN&gt;oes it always have the same format (&lt;/SPAN&gt;&lt;SPAN&gt;process_name,&amp;nbsp;signature_name,binary_description)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;* Yes&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sourcetype, I create my own and just using Splunk_TA_Windows for initial report to extract Data_Xml. Basically, it's new Sourcetype and can do transform, props as I like.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 09:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671876#M230217</guid>
      <dc:creator>jbanAtSplunk</dc:creator>
      <dc:date>2023-12-14T09:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: transform XML with same node name and add field names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671962#M230232</link>
      <description>&lt;P&gt;Do not treat structured data such as XML as string text is my usual advice. &amp;nbsp;Splunk's built-in routines designed to process XML (e.g., &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;spath&lt;/A&gt;) is much more robust than any regex you can construct.&lt;/P&gt;&lt;P&gt;If you have difficulty with using spath and such, post sample/mock data (anonymize as needed) and explain what search you use and what result you get, how the result is different from your desires.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 18:42:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/transform-XML-with-same-node-name-and-add-field-names/m-p/671962#M230232</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-12-14T18:42:57Z</dc:date>
    </item>
  </channel>
</rss>

