<?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: Is it possible to extract nested data make 2 key? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615943#M214032</link>
    <description>&lt;P&gt;Some of pieces of data different but I'll try to change. The answer is correct.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 09:29:28 GMT</pubDate>
    <dc:creator>batabay</dc:creator>
    <dc:date>2022-10-05T09:29:28Z</dc:date>
    <item>
      <title>Is it possible to extract nested data make 2 keys?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615168#M213792</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;
&lt;P&gt;I have data like this,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Primary Key_1:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;subkey_1 : subvalue_1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;subkey_2 : subvalue_2&lt;/P&gt;
&lt;P&gt;Primary Key_2:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;subkey_1 : subvalue_1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;subkey_2 : subvalue_2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I extract data like this, But I want to see in splunk like key1.subkey_1 = sub_value_1&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="batabay_0-1664448881683.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21764i2049F663A39E4144/image-size/medium?v=v2&amp;amp;px=400" role="button" title="batabay_0-1664448881683.png" alt="batabay_0-1664448881683.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Btw, this is one event.&lt;/P&gt;
&lt;P&gt;I try in transforms.conf ($1::$2:):$3 , But I failed.&lt;/P&gt;
&lt;P&gt;And I want to extract this data, What is the best way extract this for as I want. Or is that possible ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 13:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615168#M213792</guid>
      <dc:creator>batabay</dc:creator>
      <dc:date>2022-10-05T13:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to extract nested data make 2 key?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615733#M213968</link>
      <description>&lt;P&gt;Presumably this is a multi line event?&lt;/P&gt;&lt;P&gt;Are there finite limits to how many primary keys will be in the data? Like are there always 2 primary keys? Or could there be more/less depending on the event that comes in?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 22:54:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615733#M213968</guid>
      <dc:creator>jdunlea</dc:creator>
      <dc:date>2022-10-03T22:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to extract nested data make 2 key?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615765#M213980</link>
      <description>&lt;P&gt;If the data is highly formatted as illustrated and assuming primary key names and values do not contain space, I'd turn the string into conformant data using the following, then you can use spath to extract.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed max_match=0 "s/([^:\s]+)\s*:/\"\1\":/g"
| rex mode=sed max_match=0 "s/: +(\S+)/:\"\1\"/g"
| rex mode=sed "s/^\"/{\"/g"
| rex mode=sed max_match=0 "s/(\s+)\"/\1{\"/g"
| rex mode=sed max_match=0 "s/\"\s\s+{/\", /g"
| rex mode=sed "s/\"\s+{/\"},
 /"
| rex mode=sed "s/\"$/\"}
}/"
| spath&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;PrimaryKey_1.subkey_1&lt;/TD&gt;&lt;TD&gt;PrimaryKey_1.subkey_2&lt;/TD&gt;&lt;TD&gt;PrimaryKey_2.subkey_1&lt;/TD&gt;&lt;TD&gt;PrimaryKey_2.subkey_2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;subvalue_1&lt;/TD&gt;&lt;TD&gt;subvalue_2&lt;/TD&gt;&lt;TD&gt;subvalue_1&lt;/TD&gt;&lt;TD&gt;subvalue_2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;In case you have this question in mind: This cannot be implemented in transforms.conf.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 05:41:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615765#M213980</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-10-04T05:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to extract nested data make 2 key?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615943#M214032</link>
      <description>&lt;P&gt;Some of pieces of data different but I'll try to change. The answer is correct.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 09:29:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-extract-nested-data-make-2-keys/m-p/615943#M214032</guid>
      <dc:creator>batabay</dc:creator>
      <dc:date>2022-10-05T09:29:28Z</dc:date>
    </item>
  </channel>
</rss>

