Dashboards & Visualizations

if criteria matches a in my control file then show or hide a dashboard

surekhasplunk
Communicator

Hi,

My requirement is if i my login name appears in column name employee of my mapping.csv file which is my control file then i should load a particular dashboard.
And if my login name is listed under manager column in my control file then and different dashboard should populate.
How to do it in splunk dashboard.

Thanks

Tags (2)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi @surekhasplunk ,

I don't think so we can manage permission of particular dashboard using any lookup file or csv file. But you can achieve this. Can you please try below XML? I have used user_mapping.csv with emp_username column only. You have to stored allowed username in this file. If logged in username is available in user_mapping.csv file then dashboard's panel will display otherwise it will display Access Denied. Here I have used sample panels and searches.

<dashboard>
  <label>Dashboard using login person</label>
  <search>
      <query>| inputlookup user_mapping.csv where emp_username="$env:user$" | stats count</query>
      <progress>
        <condition match="'result.count' == &quot;0&quot;">
          <unset token="employee_rights"/>
          <set token="access_denied">true</set>
        </condition>
        <condition>
          <unset token="access_denied"/>
          <set token="employee_rights">true</set>
        </condition>
      </progress>
    </search>
    <row>
    <panel depends="$access_denied$">
      <html>
        <h1>$env:user$ : Access Denied.</h1>
      </html>
    </panel>
    </row>
  <row>
    <panel depends="$employee_rights$">
      <table>
        <title>Dashboard Panel - 1</title>
        <search>
          <query>| inputlookup user_mapping.csv</query>
        </search>
        <option name="count">100</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
    <panel depends="$employee_rights$">
      <table>
        <title>Dashboard Panel - 2</title>
        <search>
          <query>| inputlookup user_mapping.csv</query>
        </search>
        <option name="count">100</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
</dashboard>

Please let me know for further assistance.

Thanks
Kamlesh

crasgele
Engager

Thanks for the answer kamlesh_vaghela. I had the same issue and this works fine.

0 Karma

cmerriman
Super Champion

you'll want to create a conditional token for these possibilities and use depends on the panels you want to populate.
http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/tokens#Search_tokens_for_dynamic_display_...
http://docs.splunk.com/Documentation/SplunkCloud/6.6.3/Viz/PanelreferenceforSimplifiedXML#Shared_att...

something like this where the search with employee column resides (and do the same logic for manager, creating a token called manager):

 <progress>
       <condition match="'result.employee' == name">
           <set token="employee">true</set>
       </condition>
       <condition>
           <unset token="employee"/>
       </condition>
   </progress>

then, in the panels you want to hide/show, use <panel depends=$employee$> and <panel depends=$manager$> or a combination of both

0 Karma
Get Updates on the Splunk Community!

What’s new on Splunk Lantern in August

This month’s Splunk Lantern update gives you the low-down on all of the articles we’ve published over the past ...

Welcome to the Future of Data Search & Exploration

You have more data coming at you than ever before. Over the next five years, the total amount of digital data ...

This Week's Community Digest - Splunk Community Happenings [8.3.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...