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!

Update Your SOAR Apps for Python 3.13: What Community Developers Need to Know

To Community SOAR App Developers - we're reaching out with an important update regarding Python 3.9's ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Automatic Discovery Part 2: Setup and Best Practices

In Part 1 of this series, we covered what Automatic Discovery is and why it’s critical for observability at ...