<?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: How do you parse nested Amazon Web Services fields? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397997#M70967</link>
    <description>&lt;P&gt;Thanks @493669 &lt;/P&gt;

&lt;P&gt;I was able to extract the correct data using spath.&lt;/P&gt;

&lt;P&gt;My search was:&lt;BR /&gt;
    index=test&lt;BR /&gt;
    | spath path=rules{} output=rules &lt;BR /&gt;
    | mvexpand rules &lt;BR /&gt;
    | rename rules as _raw &lt;BR /&gt;
    | spath&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 10:12:48 GMT</pubDate>
    <dc:creator>MABurberry</dc:creator>
    <dc:date>2019-01-14T10:12:48Z</dc:date>
    <item>
      <title>How do you parse nested Amazon Web Services fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397995#M70965</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am having some troubles parsing nested AWS fields.&lt;/P&gt;

&lt;P&gt;The data that I have looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     rules: [   [-] 
        {   [-] 
         from_port:  80 
         grants:    [   [-] 
            {   [-] 
             cidr_ip:    10.51.4.20/31      
             group_id:   null   
             name:   null   
             owner_id:   null   
            }   
            {   [-] 
             cidr_ip:    10.51.4.8/31       
             group_id:   null   
             name:   null   
             owner_id:   null   
            }   
            {   [-] 
             cidr_ip:    10.51.4.2/31   
             group_id:   null   
             name:   null   
             owner_id:   null   
            }   
        ]   
         groups:    
         ipRanges:   

         ip_protocol:    tcp    
         to_port:    80 
        }   
        {   [-] 
         from_port:  0  
         grants:    [   [-] 
            {   [-] 
             cidr_ip:    10.0.1.9/21    
             group_id:   null   
             name:   null   
             owner_id:   null   
            }   
        ]   
         groups:    
         ipRanges:   

         ip_protocol:    tcp    
         to_port:    65535  
        }   
        {   [-] 
         from_port:  7002   
         grants:    [   [-] 
            {   [-] 
             cidr_ip:    10.0.1.7/21    
             group_id:   null   
             name:   null   
             owner_id:   null   
            }   
            {   [-] 
             cidr_ip:    10.0.1.5/21    
             group_id:   null   
             name:   null   
             owner_id:   null   
            }   
            {   [-] 
             cidr_ip:    10.0.1.2/21    
             group_id:   null   
             name:   null   
             owner_id:   null   
            }   
        ]   
         groups:    
         ipRanges:   

         ip_protocol:    tcp    
         to_port:    7002   
        }   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to be able to parse these fields so they show up like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;IP Address      FROM_PORT TO_PORT
10.51.4.20/31 80                   80
10.51.4.8/31   80                   80
10.51.4.2/31   80                   80
10.0.1.9/21     0                     65535
10.0.1.7/21 7002               7002
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried MVZip then MVExpand but I cannot seem to get it working correctly. Does anyone have any ways to solve this please?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 09:08:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397995#M70965</guid>
      <dc:creator>MABurberry</dc:creator>
      <dc:date>2019-01-14T09:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do you parse nested Amazon Web Services fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397996#M70966</link>
      <description>&lt;P&gt;Hi @MABurberry,&lt;/P&gt;

&lt;P&gt;can you try &lt;CODE&gt;|spath&lt;/CODE&gt; command like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;YourIndexname&amp;gt;|spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.3/SearchReference/Spath"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.3/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 09:40:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397996#M70966</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2019-01-14T09:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do you parse nested Amazon Web Services fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397997#M70967</link>
      <description>&lt;P&gt;Thanks @493669 &lt;/P&gt;

&lt;P&gt;I was able to extract the correct data using spath.&lt;/P&gt;

&lt;P&gt;My search was:&lt;BR /&gt;
    index=test&lt;BR /&gt;
    | spath path=rules{} output=rules &lt;BR /&gt;
    | mvexpand rules &lt;BR /&gt;
    | rename rules as _raw &lt;BR /&gt;
    | spath&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 10:12:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397997#M70967</guid>
      <dc:creator>MABurberry</dc:creator>
      <dc:date>2019-01-14T10:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you parse nested Amazon Web Services fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397998#M70968</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;you need a bit more than just spath&lt;/P&gt;

&lt;P&gt;in this example you can see how to use spath in the way you wanted your example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval _raw = "{\"rules\": [{\"from\": 1, \"grant\":[{\"ip\": 12}, {\"ip\": 34}]}, {\"from\": 2, \"grant\":[{\"ip\": 56}, {\"ip\": 78}]}]}" | spath rules{} output=rules | mvexpand rules | spath input=rules
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;use just the part after |spath and change the names.&lt;/P&gt;

&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 10:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-nested-Amazon-Web-Services-fields/m-p/397998#M70968</guid>
      <dc:creator>dkeck</dc:creator>
      <dc:date>2019-01-14T10:17:50Z</dc:date>
    </item>
  </channel>
</rss>

