Dashboards & Visualizations

Why is an HTML dashboard showing its file name in the navigation menu, not the label?

arkadyz1
Builder

I'm experimenting with HTML dashboards. One problem - if I add one to the navigation menu, I cannot show a different name - it shows the file name (without .html) up there. For XML dashboards, their label is displayed, but Splunk doesn't seem to know what to extract from HTML (is it even implemented?). I tried label= attribute, just like collection tag, but it didn't work either.

In fact, I cannot change what is displayed for any dashboard - it's label tag content from XML and file name from HTML. Is there any way to fix it?

1 Solution

badarsebard
Communicator

One of the reasons an HTML dashboard may show an incorrect title is that the title will revert to the file name if the HTML is not properly formatted. If there are any issues with tags and end tags being mismatched or anything that would throw of an HTML checker it will "fail" this check and cause Splunk not to get the correct title from the header of the page.

Also, if you have custom javascript in your dashbaord you need to wrap it in what I call "fake" CDATA tags (at least in versino 6.5, I haven't tested for others). Basically, for whatever Splunk uses to verify the HTML of a page, javascript needs to be wrapped like this:
there's a space inserted in front of the ! so the site doesn't think I need an actual cdata tag
// < ![CDATA[

... code goes here ...

// ]]>

Despite being commented out, and of no use to a browser, the HTML checker Splunk uses looks for those tags and ignores the things between them. This prevents JS code from tripping the checker with an error and allows Splunk to properly grab a page title.

View solution in original post

skisoccer13
Explorer

I hate to bring this back up but we are now on version 7 of Splunk and I still have yet to find a solution other than use the anchor tag in the navigation menu to link back to Splunk.

0 Karma

Anam
Community Manager
Community Manager

Hi skisoccer13

This question is almost 3 years old. Please post a new question to get maximum exposure and help on your problem.

Thanks!

0 Karma

badarsebard
Communicator

One of the reasons an HTML dashboard may show an incorrect title is that the title will revert to the file name if the HTML is not properly formatted. If there are any issues with tags and end tags being mismatched or anything that would throw of an HTML checker it will "fail" this check and cause Splunk not to get the correct title from the header of the page.

Also, if you have custom javascript in your dashbaord you need to wrap it in what I call "fake" CDATA tags (at least in versino 6.5, I haven't tested for others). Basically, for whatever Splunk uses to verify the HTML of a page, javascript needs to be wrapped like this:
there's a space inserted in front of the ! so the site doesn't think I need an actual cdata tag
// < ![CDATA[

... code goes here ...

// ]]>

Despite being commented out, and of no use to a browser, the HTML checker Splunk uses looks for those tags and ignores the things between them. This prevents JS code from tripping the checker with an error and allows Splunk to properly grab a page title.

emeffert
Engager

This answer was helpfull for me.. Because of an inproper html we didn't get the title right. After fixing the html, the title was showing correctly. Thanks!

0 Karma

skisoccer13
Explorer

I downvoted this post because this is not an answer for the question at all.

0 Karma

emeffert
Engager

Why? It's the correct answer.. If your html is properly formated the title will show correctly..

0 Karma

skisoccer13
Explorer

The CDADA tag is not used in pure HTML dashboards which is what the poster was stating he/she was doing. Javascript does not have to be wrapped in anything in a pure HTML dashboard. Splunk does absolutely no checking of any code in a HTML dashboard.

0 Karma

badarsebard
Communicator

Give it a try, create a blank dashboard and convert to HTML. The title of the tab is set in the element. In a converted dashboard the CDATA tags I referred to are right above the require statement. As you can see they are commented out in the HTML syntax, but if you remove them and save, the title of the tab will revert back to the html file name.

Hope you find it illuminating and happy Splunking!

0 Karma

badarsebard
Communicator

How so? It explains the (potential) cause and how to correct.

0 Karma

arkadyz1
Builder

Thanks for the answer. That's what I hate about Splunk - so much arcane knowledge, which is either not documented or is hard to find.
Since the time I asked this question, we completely moved away from HTML dashboards - we found ways to attach our JavaScript to the specific items on the dashboard using ID. And it's very useful to keep the ability to edit panels easily - we need to be more dynamic than that.

0 Karma

vbumgarner
Contributor

What is the HTML checker that Splunk uses?

0 Karma

krishnarajapant
Path Finder

Hi,

We can clone the view in settings-userinterface-views under your applications

and you can add that view name in navigation.

settings-userinterface-navigations under your application

I have tested this in my server and it is working

-Krishna Rajapantula

0 Karma

arkadyz1
Builder

No, that's not helpful - the new view is also referred by its internal name. I cannot have a menu item reading "My HTML Dashboard", for example - filenames in Splunk don't allow whitespaces, among other things. If I wanted to have my_html_dashboard menu item, I would have named my new dashboard that way from the beginning.

I believe Splunk has no way to do it properly for HTML dashboards. I'd suggest something like &lt;view name="my_html_dashboard"&gt;My HTML Dashboard&lt;/view&gt; - it's not working right now, but it might be a good model to implement.

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