Splunk Search

Compare values in two different json objects

barosan007
Explorer

Hello, 

This question has probably been asked and answered, but I just can't seem to find a best solution. 

So, in the results I want to table the Allow and Deny values. And the second result would be the | search Action=eks* only where the Effect is Allow. I have tried till now, but I cannot relate the Allow action, it lists all values. Thanks in Advance. 



{ "Action": [
"eks:*",
"ecs:*"
],
"Effect": "Allow"
 
},
{
"Action": [
"config:*",
"budgets:*"
],
"Effect": "Deny",
}
Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| spath "Action{}" output="Action"
| spath "Effect"
| mvexpand Action

View solution in original post

barosan007
Explorer

Finally, this worked for me.  Thanks for advice. 

| mvexpand Json
| spath "Action{}" input=Json output="Action"
| spath "Effect" input=Json output="Effect"
| mvexpand Action
| table Action Effect
0 Karma

barosan007
Explorer
Action NameEffect
eksallow
ecsallow
configdeny
budgetsdeny
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| spath "Action{}" output="Action"
| spath "Effect"
| mvexpand Action

ITWhisperer
SplunkTrust
SplunkTrust

Please can you give an example of your expected results?

Get Updates on the Splunk Community!

Archived Metrics Now Available for APAC and EMEA realms

We’re excited to announce the launch of Archived Metrics in Splunk Infrastructure Monitoring for our customers ...

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

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