<?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 I make a table out of common nested json keys with uncommon json key parents? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353900#M104740</link>
    <description>&lt;P&gt;@zhatsispgx, Try the following run anywhere search based on sample data provided. Commands till &lt;CODE&gt;... | spath&lt;/CODE&gt; generate dummy data/fields as per the question.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw= "{
     \"plugins\": {
         \"Redirection\": {
             \"pluginstatus\": \"active\",
             \"wpvulndb\": {
                 \"popular\": true,
                 \"vulnerabilities\": [{
                     \"vulnerablestatus\": false,
                     \"title\": \"Redirection 2.3.3 - view/admin/item.php URL H&amp;amp;ling Reflected XSS\",
                     \"created_at\": \"2014-08-01T10:59:06.000Z\",
                     \"updated_at\": \"2015-05-15T13:48:24.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"references\": {},
                     \"published_date\": null,
                     \"fixed_in\": \"2.3.4\",
                     \"id\": 7001
                 }, {
                     \"vulnerablestatus\": false,
                     \"title\": \"Redirection - view/admin/log_item.php Non-existent Posts Referer HTTP Header XSS\",
                     \"created_at\": \"2014-08-01T10:59:06.000Z\",
                     \"updated_at\": \"2015-05-15T13:48:24.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"references\": {
                         \"cve\": [\"2011-4562\"],
                         \"secunia\": [\"46310\"]
                     },
                     \"published_date\": null,
                     \"fixed_in\": \"2.2.10\",
                     \"id\": 7002
                 }, {
                     \"vulnerablestatus\": false,
                     \"title\": \"Redirection - wp-admin/tools.php id Parameter XSS\",
                     \"created_at\": \"2014-08-01T10:59:06.000Z\",
                     \"updated_at\": \"2015-05-15T13:48:24.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"references\": {
                         \"secunia\": [\"45782\"]
                     },
                     \"published_date\": null,
                     \"fixed_in\": \"2.2.9\",
                     \"id\": 7003
                 }],
                 \"last_updated\": \"2018-01-30T07:26:00.000Z\",
                 \"latest_version\": \"3.1.1\"
             },
             \"version\": \"2.6.6\",
             \"pluginpath\": \"redirection/redirection.php\"
         },
         \"Yoast SEO Premium\": {
             \"pluginstatus\": \"active\",
             \"wpvulndb\": {
                 \"popular\": false,
                 \"vulnerabilities\": [{
                     \"vulnerablestatus\": false,
                     \"title\": \"WordPress SEO by Yoast &amp;lt;= 2.0.1 - Cross-Site Scripting (XSS)\",
                     \"created_at\": \"2015-04-20T17:38:38.000Z\",
                     \"updated_at\": \"2015-10-01T08:11:16.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"published_date\": \"2015-04-20T00:00:00.000Z\",
                     \"fixed_in\": \"2.1\",
                     \"id\": 7913
                 }],
                 \"last_updated\": null,
                 \"latest_version\": null
             },
             \"version\": \"3.0.7\",
             \"pluginpath\": \"wordpress-seo-premium/wp-seo-premium.php\"
         }
     }
 }"
 | spath
 | fields *.vulnerablestatus *.title
 | foreach *.title [eval "&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;.zippedData"=mvzip('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;','&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;.vulnerablestatus',";")]
 | table *.zippedData
 | transpose
 | mvexpand "row 1"
 | eval "row 1"=split('row 1',";")
 | eval vulnerability=mvindex('row 1',0),vulnerability_status=mvindex('row 1',1)
 | eval plugin_name=replace(vulnerability,"^(\w+)(.*)","\1"), plugin_vulnarability=replace(vulnerability,"^([^-]-\s)(.*)","\2")
 | table plugin_name plugin_vulnarability vulnerability_status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Feb 2018 05:13:15 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2018-02-02T05:13:15Z</dc:date>
    <item>
      <title>how do I make a table out of common nested json keys with uncommon json key parents?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353899#M104739</link>
      <description>&lt;P&gt;I have the following JSON event that I'm indexing in splunk:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "plugins": {
        "Redirection": {
            "pluginstatus": "active",
            "wpvulndb": {
                "popular": true,
                "vulnerabilities": [{
                    "vulnerablestatus": false,
                    "title": "Redirection 2.3.3 - view/admin/item.php URL H&amp;amp;ling Reflected XSS",
                    "created_at": "2014-08-01T10:59:06.000Z",
                    "updated_at": "2015-05-15T13:48:24.000Z",
                    "vuln_type": "XSS",
                    "references": {},
                    "published_date": null,
                    "fixed_in": "2.3.4",
                    "id": 7001
                }, {
                    "vulnerablestatus": false,
                    "title": "Redirection - view/admin/log_item.php Non-existent Posts Referer HTTP Header XSS",
                    "created_at": "2014-08-01T10:59:06.000Z",
                    "updated_at": "2015-05-15T13:48:24.000Z",
                    "vuln_type": "XSS",
                    "references": {
                        "cve": ["2011-4562"],
                        "secunia": ["46310"]
                    },
                    "published_date": null,
                    "fixed_in": "2.2.10",
                    "id": 7002
                }, {
                    "vulnerablestatus": false,
                    "title": "Redirection - wp-admin/tools.php id Parameter XSS",
                    "created_at": "2014-08-01T10:59:06.000Z",
                    "updated_at": "2015-05-15T13:48:24.000Z",
                    "vuln_type": "XSS",
                    "references": {
                        "secunia": ["45782"]
                    },
                    "published_date": null,
                    "fixed_in": "2.2.9",
                    "id": 7003
                }],
                "last_updated": "2018-01-30T07:26:00.000Z",
                "latest_version": "3.1.1"
            },
            "version": "2.6.6",
            "pluginpath": "redirection/redirection.php"
        },
        "Yoast SEO Premium": {
            "pluginstatus": "active",
            "wpvulndb": {
                "popular": false,
                "vulnerabilities": [{
                    "vulnerablestatus": false,
                    "title": "WordPress SEO by Yoast &amp;lt;= 2.0.1 - Cross-Site Scripting (XSS)",
                    "created_at": "2015-04-20T17:38:38.000Z",
                    "updated_at": "2015-10-01T08:11:16.000Z",
                    "vuln_type": "XSS",
                    "published_date": "2015-04-20T00:00:00.000Z",
                    "fixed_in": "2.1",
                    "id": 7913
                }],
                "last_updated": null,
                "latest_version": null
            },
            "version": "3.0.7",
            "pluginpath": "wordpress-seo-premium/wp-seo-premium.php"
        }
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if you notice, each 'plugin' has its own 'vulnerablestatus' .  How would I create a table that would display each plugin name (in this case, "Redirection" and "Yoast SEO Premium") and its "vulnerablestatus" if its "vulnerablestatus"=true ? Ideally I dont want to have to reference each plugin when building the table. i.e.   &lt;CODE&gt;|table plugins.*.vulnerabilities{}.vulnerablestatus, plugins.*.vulnerabilities{}.title&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;I would like each row to look like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;pluginname | plugin vulnerability | vulnerabilitystatus
......................................................................................................
redirection   | "... HTTP Header XSS" | false 
redirection   | "... Parameter XSS"      | false 
Yoast SEO ... |" ... XSS"               | false
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 00:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353899#M104739</guid>
      <dc:creator>zhatsispgx</dc:creator>
      <dc:date>2018-02-02T00:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: how do I make a table out of common nested json keys with uncommon json key parents?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353900#M104740</link>
      <description>&lt;P&gt;@zhatsispgx, Try the following run anywhere search based on sample data provided. Commands till &lt;CODE&gt;... | spath&lt;/CODE&gt; generate dummy data/fields as per the question.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw= "{
     \"plugins\": {
         \"Redirection\": {
             \"pluginstatus\": \"active\",
             \"wpvulndb\": {
                 \"popular\": true,
                 \"vulnerabilities\": [{
                     \"vulnerablestatus\": false,
                     \"title\": \"Redirection 2.3.3 - view/admin/item.php URL H&amp;amp;ling Reflected XSS\",
                     \"created_at\": \"2014-08-01T10:59:06.000Z\",
                     \"updated_at\": \"2015-05-15T13:48:24.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"references\": {},
                     \"published_date\": null,
                     \"fixed_in\": \"2.3.4\",
                     \"id\": 7001
                 }, {
                     \"vulnerablestatus\": false,
                     \"title\": \"Redirection - view/admin/log_item.php Non-existent Posts Referer HTTP Header XSS\",
                     \"created_at\": \"2014-08-01T10:59:06.000Z\",
                     \"updated_at\": \"2015-05-15T13:48:24.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"references\": {
                         \"cve\": [\"2011-4562\"],
                         \"secunia\": [\"46310\"]
                     },
                     \"published_date\": null,
                     \"fixed_in\": \"2.2.10\",
                     \"id\": 7002
                 }, {
                     \"vulnerablestatus\": false,
                     \"title\": \"Redirection - wp-admin/tools.php id Parameter XSS\",
                     \"created_at\": \"2014-08-01T10:59:06.000Z\",
                     \"updated_at\": \"2015-05-15T13:48:24.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"references\": {
                         \"secunia\": [\"45782\"]
                     },
                     \"published_date\": null,
                     \"fixed_in\": \"2.2.9\",
                     \"id\": 7003
                 }],
                 \"last_updated\": \"2018-01-30T07:26:00.000Z\",
                 \"latest_version\": \"3.1.1\"
             },
             \"version\": \"2.6.6\",
             \"pluginpath\": \"redirection/redirection.php\"
         },
         \"Yoast SEO Premium\": {
             \"pluginstatus\": \"active\",
             \"wpvulndb\": {
                 \"popular\": false,
                 \"vulnerabilities\": [{
                     \"vulnerablestatus\": false,
                     \"title\": \"WordPress SEO by Yoast &amp;lt;= 2.0.1 - Cross-Site Scripting (XSS)\",
                     \"created_at\": \"2015-04-20T17:38:38.000Z\",
                     \"updated_at\": \"2015-10-01T08:11:16.000Z\",
                     \"vuln_type\": \"XSS\",
                     \"published_date\": \"2015-04-20T00:00:00.000Z\",
                     \"fixed_in\": \"2.1\",
                     \"id\": 7913
                 }],
                 \"last_updated\": null,
                 \"latest_version\": null
             },
             \"version\": \"3.0.7\",
             \"pluginpath\": \"wordpress-seo-premium/wp-seo-premium.php\"
         }
     }
 }"
 | spath
 | fields *.vulnerablestatus *.title
 | foreach *.title [eval "&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;.zippedData"=mvzip('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;','&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;.vulnerablestatus',";")]
 | table *.zippedData
 | transpose
 | mvexpand "row 1"
 | eval "row 1"=split('row 1',";")
 | eval vulnerability=mvindex('row 1',0),vulnerability_status=mvindex('row 1',1)
 | eval plugin_name=replace(vulnerability,"^(\w+)(.*)","\1"), plugin_vulnarability=replace(vulnerability,"^([^-]-\s)(.*)","\2")
 | table plugin_name plugin_vulnarability vulnerability_status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Feb 2018 05:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353900#M104740</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-02T05:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: how do I make a table out of common nested json keys with uncommon json key parents?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353901#M104741</link>
      <description>&lt;P&gt;this looks like it does what I need, however I have one key that looks like it has a &lt;CODE&gt;|&lt;/CODE&gt; in it which is making the rest puke. The sample above isn't the full payload i'd be searching against.. just 2 plugin samples.  &lt;/P&gt;

&lt;P&gt;I'm getting the error &lt;CODE&gt;Failed to parse templatized search for field 'plugins.Shareaholic | share buttons analytics related content.wpvulndb.vulnerabilities{}.title'&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Feb 2018 18:34:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353901#M104741</guid>
      <dc:creator>zhatsispgx</dc:creator>
      <dc:date>2018-02-02T18:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: how do I make a table out of common nested json keys with uncommon json key parents?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353902#M104742</link>
      <description>&lt;P&gt;@zhatsispgx, Can you paste that key which has a pipe character? &lt;CODE&gt;|&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Also can you try the following?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;YourBaseSearch&amp;gt;
|  eval _raw=replace(_raw,"|","")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 04 Feb 2018 04:08:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/353902#M104742</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-04T04:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: how do I make a table out of common nested json keys with uncommon json key parents?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/566425#M197400</link>
      <description>&lt;P&gt;Thanks for the post. I have resolved the yoast plugin problem on this site ( &lt;A href="https://seotraining.co" target="_blank"&gt;https://seotraining.co&lt;/A&gt;&amp;nbsp;).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 09:51:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-make-a-table-out-of-common-nested-json-keys-with/m-p/566425#M197400</guid>
      <dc:creator>SEOCommmunity</dc:creator>
      <dc:date>2021-09-09T09:51:40Z</dc:date>
    </item>
  </channel>
</rss>

