icon/x Created with Sketch.

Splunk Cookie Policy

We use our own and third-party cookies to provide you with a great online experience. We also use these cookies to improve our products and services, support our marketing campaigns, and advertise to you on our website and other websites. Some cookies may continue to collect information after you have left our website. Learn more (including how to update your settings) here.
Accept Cookie Policy

We are working on something new...

A Fresh New Splunkbase
We are designing a New Splunkbase to improve search and discoverability of apps. Check out our new and improved features like Categories and Collections. New Splunkbase is currently in preview mode, as it is under active development. We welcome you to navigate New Splunkbase and give us feedback.

Accept License Agreements

This app is provided by a third party and your right to use the app is in accordance with the license provided by that third-party licensor. Splunk is not responsible for any third-party apps and does not provide any warranty or support. If you have any questions, complaints or claims with respect to this app, please contact the licensor directly.

Thank You

Downloading array2object
SHA256 checksum (array2object_100.tgz) 39460c750efd4bc0dc39a4935c51a19d36f29dae74570f5950a94fb1736a9f8c SHA256 checksum (array2object_016.tgz) 2a539069e3a4f592d34b3e40fda8d482c7dddf462944c103a6cce9a43073247a SHA256 checksum (array2object_015.tgz) b9b509299a70b22349e7c0cc88068ad6df2f897c1d0207001b6072859368f908 SHA256 checksum (array2object_014.tgz) d3bf224450753b0847d7e42b39f951483d5a7570fb3aefb1f74ace8170a60b54 SHA256 checksum (array2object_013.tgz) ac9f1d5c23e91d823c8c32efa6445512cc992c00637a99af68f17c942812a70d
To install your download
For instructions specific to your download, click the Details tab after closing this window.

Flag As Inappropriate

splunk

array2object

Splunk Cloud
Overview
Details
This custom streaming search command was developed to handle JSON data sources that contain arrays of objects, which is a common problem with the JSON response from API data sources such as CrowdStrike and Google Workspace.

The command adds additional fields using the value from the provided key, and either a specific child or all children other than the key.

All versions prior to 1.0.0 will need to be installed on both the search head and search peers to function.

https://github.com/Bre77/array2object

Syntax

| array2object field=_raw path="<path>" key="<relative path>" value="<relative path>"

Paths are expressed in dot notation, including when entering arrays. For example, event[0].key needs to be written as event.0.key.

field

Optional, defaults to _raw
Splunk field containing the JSON data to parse.

path

Mandatory
The path from the root of the JSON object to the array. Must point to an array, and must be written in dot notation eg event.AuditKeyValues.

key

Mandatory
The relative path from the array, to the value which will be used as the key for each array item. Ideally the value of this field would be unique but the command will create multivalue fields if there is overlap.

value

Optional, defaults to all children except the key
The relative path from the array, to the value(s) of the new field. Typically used to set the output to a single value like "ValueString", but accepts a relative path, and all children from the path will be added.

Example

CrowdStrike's EventStream data contains an array of objects called AuditKeyValues, where each member contains a object with the keys "Key" and "ValueString". From the root of the JSON object, this arrays path would be "event.AuditKeyValues" in dot notation.

"event":{
  "AuditKeyValues":[
    {"Key":"actor_cid","ValueString":"abcdef1234567890"},
    {"Key":"target_user","ValueString":"brett.whynot@gmail.com"}
  ]
}

Using the array2object command will create new fields using the value of the key for each of the arrays objects:
| array2object path="event.AuditKeyValues" key="Key"

event.AuditKeyValues.actor_cid.ValueString = "abcdef1234567890"
event.AuditKeyValues.target_user.ValueString = "brett.whynot@gmail.com"

When there is only a single value expected (key value pairs), you can specify the value path to get shorter field names:
| array2object path="event.AuditKeyValues" key="Key" value="ValueString"

event.AuditKeyValues.actor_cid = "abcdef1234567890"
event.AuditKeyValues.target_user = "brett.whynot@gmail.com"

Release Notes

Version 1.0.0
Nov. 24, 2021

Moved lib directory into bin directory, as lib is not included in bundle replication. All versions prior to 1.0.0 will need to be installed on search peers to function.

Version 0.1.6
Nov. 20, 2021

Updated splunklib to 1.6.18

Version 0.1.5
Nov. 4, 2021

Bugfix when key field was missing. Updated fixes to Splunklib.

Version 0.1.4
Oct. 25, 2021

Add support for dot paths to the key field too.

Version 0.1.3
Oct. 23, 2021

Major bug fix related to dynamic fields and Splunklib
https://github.com/splunk/splunk-sdk-python/issues/401

17
Installs
60
Downloads
Share Subscribe LOGIN TO DOWNLOAD

Subscribe Share

Are you a developer?

As a Splunkbase app developer, you will have access to all Splunk development resources and receive a 10GB license to build an app that will help solve use cases for customers all over the world. Splunkbase has 1000+ apps from Splunk, our partners and our community. Find an app for most any data source and user need, or simply create your own with help from our developer portal.

Follow Us:
Splunk, Splunk>,Turn Data Into Doing, Data-to-Everything, and D2E are trademarks or registered trademarks of Splunk Inc. in the United States and other countries. All other brand names,product names,or trademarks belong to their respective owners.