I'm looking at changing a javascript file on a Splunk6 instance which I can not bounce. I noticed that if I copy the original file to a new one, then reference the new file, it doesn't run.
Is there a way to force splunk to pickup this change?
<dashboard script="custom_viz.js">
<row>
<html>
<h2>Zone</h2>
<div id="custom"></div>
</html>
</row>
</dashboard>
If I
cp custom_viz.js test.js
and change the reference to test.js, nothing renders.
These aren't helping any
http://YOUR_SERVER:8000/en-US/debug/refresh?entity=/data/ui/views
http://YOUR_SERVER:8000/en-US/debug/refresh?entity=/data/ui/nav
http://YOUR_SERVER:8000/en-US/debug/refresh
Thanks
Note that there are some settings in web.conf
that can be helpful when developing an apps or other custom UI stuff, but they be unwanted in a production use-case. You wouldn't want to turn these on then forget about them, as they will impact performance for all users; therefore working from a dedicated "dev" splunk instance is recommended and tweak these settings there.
The good news is that if you don't already have a dedicated search head for app/view testing and development, it's fairly straightforward to setup a fresh search head and simply connect it to your backend indexers or all-in-one single instance. This way you can isolate your "production" users from testing/development changes, and at the same time develop more quickly due to fewer restarts. Even if you have limited server resources, you can launch a second instance of Splunk on the same box, using different ports of course and only run it as-needed. (You will have manage the copying/deployment of changes between instances.)
Resources that explain some more options:
To reload any changes done to existing java script we can bump it and create new version.
Hit following url http://server name:8000/en-US/_bump. It will display page, showing current version and button. Click on the button and then all the java script changes will be applied. However, it may not work if you are adding new file.
I tried the below with the splunk instance in my machine,
* Kept the js file inside "/appserver/static" folder of my application
* launched the url http://127.0.0.1:800/en-US/static/app/MyApp/src/js/karthi.js?123456
* It opens the content of my screit
* Now,I have modified my code and launched the url http://127.0.0.1:800/en-US/static/app/MyApp/src/js/karthi.js?**654321**
* it opens the new content...
* So you don't have to refresh or restart splunk.. Just have to change the url.. you can use Math.random() to do so..
E.G : http://127.0.0.1:800/en-US/static/app/MyApp/src/js/karthi.js? + Math.random()
... But in your case you should not hard code the JS file path in script tag...
you should add the script tag dynamically and it to head tag......
E.g: jQuery('<script src="/static/app/MyApp/karthi.js?' +Math.random() + '"/>").appendTo("head");
it Works... great job..
You have to restart splunkweb in order for new files to be picked up. The good news is that this is much quicker (typically a couple of seconds) than restarting the whole Splunk instance in (splunkweb + splunkd) and does not affect user sessions or running searches. You can restart splunkweb on the command line:
$ splunk restartss
or
$ splunk restart splunkweb
(The splunk
command points to $SPLUNK_HOME/bin/splunk
)
@ziegfried, in 6.2 there's no separate splunkweb service anymore. Does that mean I need to do a full Splunk restart to pick up new JS files?
@cphair, it's still the same command to restart the web UI portion.
try holding down shift or ctrl while hitting the refresh button in your browser.
ah it may require a restart of splunk then, may be non avoidable if it's a new js file that you are adding.
If you were to modify the existing js file, you would not have to restart.
Thanks- but this does not help. I know that the dashboard is trying to find the new js file because it renders the html block empty when I switch the reference to a file that was created. When I switch back it works without issue.