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!

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