Getting Data In

REST API - Search targetResources from Azure Audit via Java SDK

swaprks
Loves-to-Learn Lots

I am trying to query audit logs from Splunk. The logs are for azure but when I hit the below query, it only returns the text fields and not the object or array fields like initiatedBy and targetResources. Do I need to query this data in a different manner?

 

index="directoryaudit" | fields id activityDisplayName result operationType correlationId initiatedBy resultReason targetResources category loggedByService activityDateTime

Labels (2)
0 Karma

tscroggins
Influencer

Hi @swaprks,

If you're relying on automatic field-extraction, i.e. KV_MODE = auto and AUTO_KV_JSON = true or KV_MODE = json or INDEXED_EXTRACTIONS = JSON, only the nested fields are extracted, e.g.:

initiatedBy.user.id
targetResources{}.id

Arrays are extracted as multi-valued fields, e.g.:

targetResources{}.modifiedProperties{}.displayName
:=
AccountEnabled
StsRefreshTokensValidFrom
UserPrincipalName
UserType
Included Updated Properties

Automatic extraction of arrays of objects with array fields can also be confusing.

To return the native JSON directly, extract the fields as part of your search:

index=directoryaudit
| eval json=json(_raw), initiatedBy=json_extract(json, "initiatedBy"), targetResources=json_extract(json, "targetResources")
| fields id activityDisplayName result operationType correlationId initiatedBy resultReason targetResources category loggedByService activityDateTime

 

0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...