<?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 Implement Generic Indexer for XML File With Repeating Key Names in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188043#M37532</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;
I'm using splunk for few weeks and its seems really great but recently i had some issue with one of the needs in a new project.&lt;/P&gt;

&lt;P&gt;My target is to perform indexing and searching by tag inside  XML Files within the following format&lt;/P&gt;

&lt;P&gt;&lt;ITEM&gt;&lt;BR /&gt;
&lt;BLABLA&gt;value&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BLABLA&gt;value&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BLABLA&gt;value&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BLABLA&gt;xxxxz&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BCUENC&gt;ceijciejci&lt;/BCUENC&gt;&lt;BR /&gt;
&lt;/ITEM&gt;&lt;/P&gt;

&lt;H2&gt;I have no idea what will be the inner fields and how deep will they go.&lt;/H2&gt;

&lt;P&gt;a success would be for me a way to index everything by key-Value so i could search any of the keys and get all matching object with proper value within them.&lt;/P&gt;

&lt;P&gt;my senses tells me i need to write some generic regex for this so thats what i did:&lt;/P&gt;

&lt;P&gt;LINE_BREAKER=(&amp;lt;FileItem&amp;gt;.*?/) ### Object Bounderis&lt;/P&gt;

&lt;P&gt;REGEX = &amp;lt;(?&amp;lt;_KEY_1&amp;gt;.+?)&amp;gt;(?&amp;lt;_VAL_1&amp;gt;.+?)&amp;lt;\/.+?&amp;gt; ### Generic Key-Value Indexer&lt;/P&gt;

&lt;P&gt;its working really nice but there is one issue.&lt;BR /&gt;
when i have 2 duplicate key with the same name and different value its seems like splunk takes only the first one of them [for example if i search Blabla=xxxxz it wont return any results]&lt;/P&gt;

&lt;P&gt;is there any way to do it better and solve my issue? &lt;/P&gt;

&lt;P&gt;Thanks.&lt;BR /&gt;
:)&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:32:02 GMT</pubDate>
    <dc:creator>moneybox</dc:creator>
    <dc:date>2020-09-28T15:32:02Z</dc:date>
    <item>
      <title>Implement Generic Indexer for XML File With Repeating Key Names</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188043#M37532</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I'm using splunk for few weeks and its seems really great but recently i had some issue with one of the needs in a new project.&lt;/P&gt;

&lt;P&gt;My target is to perform indexing and searching by tag inside  XML Files within the following format&lt;/P&gt;

&lt;P&gt;&lt;ITEM&gt;&lt;BR /&gt;
&lt;BLABLA&gt;value&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BLABLA&gt;value&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BLABLA&gt;value&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BLABLA&gt;xxxxz&lt;/BLABLA&gt;&lt;BR /&gt;
&lt;BCUENC&gt;ceijciejci&lt;/BCUENC&gt;&lt;BR /&gt;
&lt;/ITEM&gt;&lt;/P&gt;

&lt;H2&gt;I have no idea what will be the inner fields and how deep will they go.&lt;/H2&gt;

&lt;P&gt;a success would be for me a way to index everything by key-Value so i could search any of the keys and get all matching object with proper value within them.&lt;/P&gt;

&lt;P&gt;my senses tells me i need to write some generic regex for this so thats what i did:&lt;/P&gt;

&lt;P&gt;LINE_BREAKER=(&amp;lt;FileItem&amp;gt;.*?/) ### Object Bounderis&lt;/P&gt;

&lt;P&gt;REGEX = &amp;lt;(?&amp;lt;_KEY_1&amp;gt;.+?)&amp;gt;(?&amp;lt;_VAL_1&amp;gt;.+?)&amp;lt;\/.+?&amp;gt; ### Generic Key-Value Indexer&lt;/P&gt;

&lt;P&gt;its working really nice but there is one issue.&lt;BR /&gt;
when i have 2 duplicate key with the same name and different value its seems like splunk takes only the first one of them [for example if i search Blabla=xxxxz it wont return any results]&lt;/P&gt;

&lt;P&gt;is there any way to do it better and solve my issue? &lt;/P&gt;

&lt;P&gt;Thanks.&lt;BR /&gt;
:)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188043#M37532</guid>
      <dc:creator>moneybox</dc:creator>
      <dc:date>2020-09-28T15:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Implement Generic Indexer for XML File With Repeating Key Names</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188044#M37533</link>
      <description>&lt;P&gt;You can just add the key&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to your transforms extraction. That will turn a field with multiple values into a multi-valued field.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2013 08:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188044#M37533</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2013-12-23T08:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Implement Generic Indexer for XML File With Repeating Key Names</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188045#M37534</link>
      <description>&lt;P&gt;Thanks Alot!~!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2013 08:33:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188045#M37534</guid>
      <dc:creator>moneybox</dc:creator>
      <dc:date>2013-12-23T08:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Implement Generic Indexer for XML File With Repeating Key Names</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188046#M37535</link>
      <description>&lt;P&gt;Thanks :)))&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2013 08:33:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Implement-Generic-Indexer-for-XML-File-With-Repeating-Key-Names/m-p/188046#M37535</guid>
      <dc:creator>moneybox</dc:creator>
      <dc:date>2013-12-23T08:33:26Z</dc:date>
    </item>
  </channel>
</rss>

