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!

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 ...