Splunk Search

Not able to use lookup for search in SPATH command

mohammadsharukh
Path Finder

My data is coming for 0365 as JSON, I am using SPath to get the required fields after that i want to compare the data with a static list containig roles to be monitored but unforutnaly I am getting the below error
Error in 'table' command: Invalid argument: 'role="Authentication Administrator"'

 

Its not working. PFA the releveant snaperror 0365 query.PNGerror 2.PNGexcel snap.PNG

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

I'm not sure what you want to achieve but remember that subsearch will be executed first, then its output will be formatted and substituted into the main search before running it. So with the output of your subsearch the resulting table command will look like

table _time , sourceuser, targetuser, role, Operation ((role="AuthenticationAdministrator") OR (role="Authentication Policy Administrator") OR [...])

As you can see, it doesn't make sense.

yuanliu
SplunkTrust
SplunkTrust

The problem has nothing to do with lookup or with spath. (You are not even using lookup command.)  You cannot use a subsearch in table command.  It's that simple.

Note: Always use a code box or text to illustrate search.  Screenshot is the worst form to share data like this.

I get that you want to filter ModifiedProperties{1}.NewValue to only those roles in your subsearch.  To do this, you need search command, not table command.  Something like the following

index=o365 Operation="Add member to role."
| spath path=ModifiedProperties{1}.NewValue output=role
| search 
    [| inputlookup privileged_azure_ad_roles.csv where isprivilegedadrole=true
    | fields role]
| spath path=Actor{0}.ID output=sourceuser
| rename ObjectId as targetuser
| table _time sourceuser targetuser role Operation

Hope this helps.

Tags (1)

mohammadsharukh
Path Finder

Adding to my problem, if i add table command then it gives error in rename command and if remove rename command then it throws error for spath command.

0 Karma
Get Updates on the Splunk Community!

Enter the Dashboard Challenge and Watch the .conf24 Global Broadcast!

The Splunk Community Dashboard Challenge is still happening, and it's not too late to enter for the week of ...

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...