Dashboards & Visualizations

how to set “href=….xxx..” as the default dashboard?

akdake
Explorer

Now we want to set a href as default dashboard
set as following

<nav>
…
   <collection label="Search">
        <view name=“aaa” />
        <a href="/app/abc/flashtimeline?q=search%20index=abc" default=“true”>Timeline</a>
        <view name=“bob” />
   </collection>
…
</nav>

but it still doesn’t works

Pls advise me how to set the href as the default dashboard

0 Karma
1 Solution

niketn
Legend

Seems like anchor tag will not support default attribute. Also name attribute is invalid for anchor tag. With this you can only use < view name="abc" default="true" />

In order to pass values as querystring by default to dashboard, following are your options based on your use cases:

Scenario 1
If you do not want users to see or modify values for index and query fields, you need to set them as token within a dummy search.

  1. Add the following code in Simple XML using Source editor.
    <!-- Dummy Search running without a query. Just to set default tokens -->
    <search>
    <query></query>
    <preview>
    <set token="q">search</set>
    <set token="index">abc</set>
    </preview>
    </search>

  2. Then use $q$ and $index$ later on in your query, which I think is already present in your existing Dashboard code.

Scenario 2
Only for Splunk 6.5
Splunk 6.5 has introduced <init> section in Simple XML Views which allows users to set default values on page load through token. Refer to Splunk 6.x Dashboard Examples for Set tokens on page load example.

<init>
  <set token="index">abc</token>
  <set token="q">search</token>
</init>

Scenario 3
If you want any of the values like index to be changed later on after first time load, you can add two new fields Dropdown (Dynamic with values defined by you) or Textbox (Dynamic with values set by user). Let me take dropdown example.

  1. Add new Dropdown and choose Label as "Select Index".
  2. Under Token Option add Token as index.
  3. Check Search on Change. (This will be required for dashboard refresh with selected value even for first time load).
  4. Under Static Options choose Name as abc and Value as abc.
  5. Next, select Default as abc

  6. Similarly, Add new Dropdown for "Select Query"

  7. Add Token as q

  8. Check Search on Change.

  9. Provide Static Name and Value as search

  10. Finally, select Default as search.

  11. In your existing dashabord you can continue to use $index$ and $q$ as the tokens which will be loaded with default values once the dashboard is loaded.

Disadvantage of 2nd approach is that two token fields will be visible to users.
Advantage could be that you can use Dynamic Options to provide list of indexes in case you need them.

Please try out and let me know if this helps, or if you need further assistance.

NOTE: In either of the above two approaches you will have to use view tag to set default dashboard in your navigation menu XML i.e. < view name="abc" default="true" />

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

View solution in original post

0 Karma

mrgibbon
Contributor

You need href if you want to reference a dash from another app.
Which is what I want to do.

I have tried:

<a href="cars_twitter_analysis__test_app"  default=“true”>Cars tweet analysis</a>  

<a href="overview.html"  default=“true”>Overview</a>

Etc, nothing seems to work.
I want to put in a link to the forwarder mgmt page:
"/manager/system/deploymentserver?t=2"

Thanks

0 Karma

nileshgupta
Engager

I am trying to achieve something similar. I am trying to refer a Global Dashboard of APP1 into APP2 and APP3. I want to default the values of dashboard drop downs with different values for APP1, APP2 and APP3.

Did you got any solution for your case?

0 Karma

nileshgupta
Engager

I was able to do it myself. Thanks!

0 Karma

niketn
Legend

Seems like anchor tag will not support default attribute. Also name attribute is invalid for anchor tag. With this you can only use < view name="abc" default="true" />

In order to pass values as querystring by default to dashboard, following are your options based on your use cases:

Scenario 1
If you do not want users to see or modify values for index and query fields, you need to set them as token within a dummy search.

  1. Add the following code in Simple XML using Source editor.
    <!-- Dummy Search running without a query. Just to set default tokens -->
    <search>
    <query></query>
    <preview>
    <set token="q">search</set>
    <set token="index">abc</set>
    </preview>
    </search>

  2. Then use $q$ and $index$ later on in your query, which I think is already present in your existing Dashboard code.

Scenario 2
Only for Splunk 6.5
Splunk 6.5 has introduced <init> section in Simple XML Views which allows users to set default values on page load through token. Refer to Splunk 6.x Dashboard Examples for Set tokens on page load example.

<init>
  <set token="index">abc</token>
  <set token="q">search</token>
</init>

Scenario 3
If you want any of the values like index to be changed later on after first time load, you can add two new fields Dropdown (Dynamic with values defined by you) or Textbox (Dynamic with values set by user). Let me take dropdown example.

  1. Add new Dropdown and choose Label as "Select Index".
  2. Under Token Option add Token as index.
  3. Check Search on Change. (This will be required for dashboard refresh with selected value even for first time load).
  4. Under Static Options choose Name as abc and Value as abc.
  5. Next, select Default as abc

  6. Similarly, Add new Dropdown for "Select Query"

  7. Add Token as q

  8. Check Search on Change.

  9. Provide Static Name and Value as search

  10. Finally, select Default as search.

  11. In your existing dashabord you can continue to use $index$ and $q$ as the tokens which will be loaded with default values once the dashboard is loaded.

Disadvantage of 2nd approach is that two token fields will be visible to users.
Advantage could be that you can use Dynamic Options to provide list of indexes in case you need them.

Please try out and let me know if this helps, or if you need further assistance.

NOTE: In either of the above two approaches you will have to use view tag to set default dashboard in your navigation menu XML i.e. < view name="abc" default="true" />

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

niketn
Legend

Edite my answer, added the option to do the same in Splunk 6.5 with the latest init section available on forms in Simple XML to set tokens on page load

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

gcusello
SplunkTrust
SplunkTrust

Hi akdake,
If you need to put the search dashboard as the default dashboard of your App you don't need to use href, you can set the following line in your menu

<view name="search" default="true"/>

Bye.
Giuseppe

0 Karma

mrgibbon
Contributor

Hi, did you find an answer for this problem? I want to do the same thing.
Thanks

0 Karma

gcusello
SplunkTrust
SplunkTrust

why you want to use href to launch a dashboard instead of

?
Bye.
Giuseppe

0 Karma

akdake
Explorer

href can automatically passess some search parameters. so the search(index=abc sourcetype=abc) can be open quickly by clicking.
TKS.

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 ...