All Apps and Add-ons

Can I call the static resources from an app that has global permissions?

bestSplunker
Contributor

On Search Head Cluster Mode, I have 4 search heads. I want to call some JS and CSS static resources in dashboard of search app. So how do I upload these JS and CSS to all search heads (directory : /appserver/static)? I think I can use deployer,so I follow the steps below

  1. Create an app on the deployer. and put JS and CSS file in directory /opt/splunk/etc/shcluster/apps/appname/appserver/static.

  2. Push this bundle to all search heads

  3. Set the app permissions as global

  4. Switch to dashboard of search app , and then load CSS and JS in the form tag of the dashboard.


    But it isn't working, I view the html source code of the dashboard, it doesn't load these static resources, why?

Tags (1)
0 Karma
1 Solution

bestSplunker
Contributor

Thanks @deepashri_123 for your help. if i want to add custom files from a different app to a dashboard. I need use the following syntax.

<dashboard stylesheet="<app_name>:<style_filename>.css" script="<app_name>:<script_filename>.js">

example:

<dashboard stylesheet="search:my_custom_styles.css" script="search:my_custom_script.js">

View solution in original post

bestSplunker
Contributor

Thanks @deepashri_123 for your help. if i want to add custom files from a different app to a dashboard. I need use the following syntax.

<dashboard stylesheet="<app_name>:<style_filename>.css" script="<app_name>:<script_filename>.js">

example:

<dashboard stylesheet="search:my_custom_styles.css" script="search:my_custom_script.js">

bestSplunker
Contributor

I didn't notice this before.

0 Karma

deepashri_123
Motivator

Happy to help!! Please upvote the comment if that helped you!!

0 Karma

deepashri_123
Motivator

Hey@bestSplunker,

Can you check on the search head if the app is properly pushed with the changes?On the search head the path will be /opt/splunk/etc/apps/appname/appserver/static

Also for dashboard styling you can refer this link:
https://docs.splunk.com/Documentation/Splunk/7.2.0/AdvancedDev/UseCSS

Let me know if this helps!!

Get Updates on the Splunk Community!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco &#43; Splunk! We’ve ...