Dashboards & Visualizations

How to match for a condition for main menu ?

zacksoft
Contributor

I have added a new option in the navigation menu ,  by updating the index.html in the setting->User Interface -> Navigation Menu. and it shows as expected. myDASHBOARD.

However, I want to add a condition so that the new navigation menu should show up only if the condition is met.
I am unsure if I am writing it correctly.

<nav search_view="search" color="#65A637">
  <view name="search" default='true' />
  <view name="data_models" />
  <view name="reports" />
  <view name="alerts" />
  <view name="dashboards" />
  <collection label="myDASHBOARD" />
<condition match = 'splunk_serv_name', wekwyeiyu134>
<view name="myDASHBOARD_1 />
    <view name="myDASHBOARD_2 />
 </condition>
</collection>

 

I believe I am using the condition statement wrong.
Any help ?

Labels (1)
0 Karma

niketn
Legend

@zacksoft you can perform condition for matching dashboard based on Dashboard Label. But you can not really do it based on specific fields/data.

    <!-- Dynamically list all dashboards with the word "error"-->
    <collection label="Dashboards (errors)">
        <view source="all" match="error"/>
    </collection>

 Could you please add more details on the following? How would you distinguish Splunk Server Name?

I feel the actual step would be configuration of the dashboards myDASHBOARD_1 and myDASHBOARD_2 as readable only on Splunk server wekwyeiyu134. On other servers it should not be made accessible for any role (or for specific roles if required).

    <condition match = 'splunk_serv_name', wekwyeiyu134>
<view name="myDASHBOARD_1 />
     <view name="myDASHBOARD_2 />
  </condition>

 If you really want to handle through Splunk Server name as condition, you may have to create your own navigation using Simple XML (possibly pre-built panel and include in all your dashboards or dashboard.js).

Here is an example of building Custom Navigation through Simple XML that can be moved to Pre-built Panel: https://community.splunk.com/t5/Dashboards-Visualizations/Can-we-implement-cascading-dropdowns-in-a-...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

zacksoft
Contributor

Thanks @niketn  for your response. I do have an extracted field called splunk_server that tells me the server name envrionment details. I was hoping to use that.
OR, if I can leverage this command 

<view source="all" match="error"/>

 and able to use <view source=" a specific source name" ........    instead of <view source="all" .......

0 Karma

niketn
Legend

If this is from a field in your SPL search, then Splunk's built in Navigation xml will not work for you, as that is only based on Dashboard title. So you will have to consider second option of building your own Pre-built Panel and create your own Navigation.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The XML used in the navigation menu is not the same as the Simple XML used in dashboards.

See https://dev.splunk.com/enterprise/docs/developapps/createapps/addnavsplunkapp/ for what you can do in the navigation menu.  Conditions are not on the list.

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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