Splunk Search

Help in setting up token based on User Value

shivamagrawa
Explorer

Hello,

I am trying to display couple of Dashboard Panels only to a specific user. For that i am trying to get the username and set the token if its matches with a certain value.

But somehow if i use condition tag its not working and "have_access" token is not getting set.

 

 

 <row>
    <panel>
      <search>
<query>| rest /services/authentication/current-context splunk_server=local  | eval access=if(username="kkan","True","False") | where access = True</query>

<preview>
   <condition match=" 'job.resultCount' != 0">
      <set token="have_access">True</set>
    </condition>
</preview>

        </search>
   </panel>
 </row>

<row>
    <panel depends="$have_access$">
..............

 

 

Anyone , @niketn  please help.

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Have you tried without the surrounding preview elements?

0 Karma

shivamagrawa
Explorer

Yes, i have removed the preview tag, but getting the error..

Node <condition> is not allowed here

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

OK try <done> instead of <preview>

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...