<?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 to parse JSON Arrays together to create a table in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596828#M48937</link>
    <description>&lt;P&gt;The first spath extracts the parameters array / collection into a multi-value field called parameters&lt;/P&gt;&lt;P&gt;The mvexpand creates separate events for each of the values in the parameters field&lt;/P&gt;&lt;P&gt;The second spath extracts the fields from the parameters field&lt;/P&gt;&lt;P&gt;The eval uses the value in the name field to create a field with that name and the value from the value field&lt;/P&gt;&lt;P&gt;The stats collected the values of all the fields grouped by the original _raw field i.e. the original event&lt;/P&gt;&lt;P&gt;Finally, the fields command removes (-) the extra unwanted fields.&lt;/P&gt;</description>
    <pubDate>Sat, 07 May 2022 17:06:25 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-05-07T17:06:25Z</dc:date>
    <item>
      <title>How to parse JSON Arrays together to create a table?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596803#M48932</link>
      <description>&lt;P&gt;I've recently onboarded data from Gsuite to Splunk. I'm currently trying to create a few queries, but I'm having problem creating queries do to the JSON format.&amp;nbsp; I'm currently just trying to create a table with owner name, file name, time, etc.&lt;BR /&gt;&lt;BR /&gt;I've tried using the spath command and json formatting, but I can't seem to get the data in a table. Here's an example query&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="gsuite" sourcetype="gws:reports:drive" 
| spath events{}.parameters{}.value.doc_title&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but the field isn't created.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the data in the&amp;nbsp;events{}.parameters{}.value field&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2022-05-06 at 5.25.40 PM.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19502iDCB1FD9ACA554557/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2022-05-06 at 5.25.40 PM.png" alt="Screen Shot 2022-05-06 at 5.25.40 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a sample of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
	"actor": {
		"profileId": "Sample Text"
	},
	"etag": "\"Sample Text\"",
	"events": [{
		"name": "sheets_import_range",
		"parameters": [{
			"boolValue": true,
			"name": "primary_event"
		}, {
			"name": "billable"
		}, {
			"name": "recipient_doc",
			"value": "123456789"
		}, {
			"name": "doc_id",
			"value": "123456789"
		}, {
			"name": "doc_type",
			"value": "spreadsheet"
		}, {
			"name": "is_encrypted"
		}, {
			"name": "doc_title",
			"value": "sampletext.xls"
		}, {
			"name": "visibility",
			"value": "shared_externally"
		}, {
			"name": "actor_is_collaborator_account"
		}, {
			"name": "owner",
			"value": "johndoe@gmail.com"
		}, {
			"name": "owner_is_shared_drive"
		}, {
			"name": "owner_is_team_drive"
		}],
		"type": "access"
	}],
	"id": {
		"applicationName": "drive",
		"customerId": "123456789",
		"time": "2022-05-06T20:55:00.285Z",
		"uniqueQualifier": "-123456789"
	},
	"kind": "admin#reports#activity"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like the data to look like this&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;owner              doc_title        doc_type      visibility
johndoe@gmail.com. sampletext.xls  spreadsheet   shared_externally&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 May 2022 04:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596803#M48932</guid>
      <dc:creator>tayvionp</dc:creator>
      <dc:date>2022-05-08T04:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON Arrays together to create a table</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596815#M48933</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231412"&gt;@tayvionp&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;did you tried to use the "spath" command without options?&lt;/P&gt;&lt;P&gt;It should extract all fields that you need to use in the table command.&lt;/P&gt;&lt;P&gt;Otherwise you should use the spath command more times to extract one by one all the fields you need (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath&lt;/A&gt;).&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 05:40:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596815#M48933</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-07T05:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON Arrays together to create a table</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596818#M48934</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath events{}.parameters{} output=parameters
| mvexpand parameters
| spath input=parameters
| eval {name}=value
| stats values(*) as * by _raw
| fields - parameters name value&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 07 May 2022 05:58:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596818#M48934</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-07T05:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON Arrays together to create a table</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596826#M48936</link>
      <description>&lt;P&gt;Thanks so much. This worked. If you have time could you explain each line so I can understand what's going on? If not that's fine. I'm grateful you were able to help&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 15:07:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596826#M48936</guid>
      <dc:creator>tayvionp</dc:creator>
      <dc:date>2022-05-07T15:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse JSON Arrays together to create a table</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596828#M48937</link>
      <description>&lt;P&gt;The first spath extracts the parameters array / collection into a multi-value field called parameters&lt;/P&gt;&lt;P&gt;The mvexpand creates separate events for each of the values in the parameters field&lt;/P&gt;&lt;P&gt;The second spath extracts the fields from the parameters field&lt;/P&gt;&lt;P&gt;The eval uses the value in the name field to create a field with that name and the value from the value field&lt;/P&gt;&lt;P&gt;The stats collected the values of all the fields grouped by the original _raw field i.e. the original event&lt;/P&gt;&lt;P&gt;Finally, the fields command removes (-) the extra unwanted fields.&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2022 17:06:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-parse-JSON-Arrays-together-to-create-a-table/m-p/596828#M48937</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-07T17:06:25Z</dc:date>
    </item>
  </channel>
</rss>

