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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...