Splunk Search

Why is this search returning the wrong result?

Lavani
Observer

The search query it showing only the roles for currently logged-in user. But this is not what we are looking for, we need list of users with logmon_app* roles.

| rest /services/authorization/roles/ 
| search title="logmon_app*" | table title 
| rename title as roles
| join type=left role max=0 
    [| rest /services/authentication/users 
    | table roles title 
    | rename title as userName 
    | mvexpand roles | search roles="logmon_app*" ] 
| stats values(userName) as username by roles |eval rolepresent="yes"

 

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You could try with

| rest /servicesNS/-/-/authorization/roles/ 

| rest /servicesNS/-/-/authentication/users 

although I can't guarantee it will work

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

this could be a little bit tricky when user/role have some inherited roles which could also contains some other inherited roles etc...

One way to solve this is use e.g. this app https://splunkbase.splunk.com/app/4111 and then modify those queries to solve your issues, if that didn't already solved it.

r. Ismo

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...