Update your Splunk apps to use jQuery 3.5 or higher in Splunk Cloud Platform or Splunk Enterprise
- Update your Splunk apps to use jQuery 3.5 or higher in Splunk Cloud Platform or Splunk Enterprise
- Update Simple XML dashboards
- Update your dashboards that contain custom JavaScript
- Test your updated dashboards
- Rebuild HTML dashboards
- Rebuild in Dashboard Studio
- Rebuild as Simple XML with custom JavaScript
- Write a single-page application
- Ensure that your app passes AppInspect checks
- Manually verify that you've completed updating your apps to jQuery 3.5
Splunk apps that rely on versions of jQuery lower than version 3.5 are not compatible with AWS GovCloud versions of Splunk Cloud Platform and upcoming versions of Splunk Cloud Platform and Splunk Enterprise. For compatibility with Splunk Cloud Platform and Splunk Enterprise, create updated versions of your apps that use jQuery 3.5 or higher only. Complete the following steps to ensure your deployment does not rely on jQuery versions lower than 3.5:
- Update your Simple XML dashboards from version 1.0 to version 1.1.
- Rebuild your HTML dashboards.
- Ensure your app passes AppInspect checks, particularly the
check_html_dashboards
,check_simplexml_standards_version
, andcheck_hotlinking_splunk_web_libraries
checks. - Manually check your apps for any remaining jQuery versions lower than 3.5.
Update Simple XML dashboards
To determine if you have any Simple XML dashboards, check if your dashboard is an XML file that begins with <dashboard>
or <form>
. If so, then it is a Simple XML dashboard.
To update your Simple XML dashboards, set the version attribute in the root node of your Simple XML dashboards to version="1.1"
. This changes the dashboard's jQuery from version 2.1.0 to version 3.5.0 or higher. You can then check if your dashboard appears without errors in Splunk Enterprise version 8.2 or higher.
<dashboard version="1.1" script="myCustomJS.js"> ... </dashboard>
<form version="1.1" script="myCustomJS.js"> ... </form>
If your dashboard contains errors when you load it in Splunk Enterprise version 8.2 or higher, you need to take additional steps to update and test them.
Update your dashboards that contain custom JavaScript
If your dashboard uses custom JavaScript that is incompatible with jQuery 3.5, complete the following steps to change the custom JavaScript.
- Locate the custom JavaScript in your $SPLUNK_HOME/etc/apps/appname/appserver/static/scriptname.js file, and note the name of the script.
- Before you make changes, save your script with a different script name in the same directory. You need an older version of your script to load dashboards version 1.0 and an updated version of your script to load dashboards version 1.1. If you have a copy of each version, you can switch between dashboards 1.0 and 1.1 during testing.
- In your preferred editor, open one of the script files to update.
- Fix your custom JavaScript in that file to be compatible with jQuery 3.5 or higher.
If your apps bundle jQuery, update the bundled version to 3.5 or higher. Ensure that your apps specify
jQuery 3.5
, not justjQuery
or any other version.
Test your updated dashboards
You can test your updated dashboards in Splunk Enterprise version 8.2.x. To test your dashboard, complete the following steps:
- To test your updated dashboard, temporarily remove the explicit declaration of version from your Simple XML by removing the
version="1.1"
orversion="1.0"
attribute in the root node of your Simple XML dashboards. - Start Splunk Enterprise 8.2.x with your app loaded.
- Load your dashboard. If it doesn't load, you can temporarily view it with the dashboards version 1.0.
- Fix any remaining dependencies on lower versions of jQuery or other errors, and try to view it again with the dashboards version 1.1.
- Once your dashboard is working in version 1.1, explicitly set the version attribute in the root node of your Simple XML dashboard to
version="1.1"
. This certifies that your dashboard relies exclusively on jQuery versions 3.5 and higher.
To verify that you've updated to jQuery 3.5, complete the following steps:
Create a JavaScript file and add the following code:
require([ 'jquery', ], function($,) { console.log($()) });
Save the file in the /appserver/static/ directory.
Add a reference to this file in your dashboard:
<form script="checkMyJqueryVersion.js"> .... </form>
From your dashboard, navigate to the browser console.
Scroll to the line
jquery: "3.5.0"
.If you do not see this line, or the line is
jquery: "2.1.0"
or any other version instead, then your dashboard is not using the correct version of jQuery. Update the dashboard's jQuery and the dashboard's version to v1.1 and check again.
Rebuild HTML dashboards
The AppInspect check check_html_dashboards
returns a failure if your app contains any HTML dashboards. HTML dashboards are deprecated. They are not compatible with versions of Splunk Cloud Platform and Splunk Enterprise that require jQuery 3.5 or higher. You need to replace your HTML dashboards to support AWS GovCloud Splunk Cloud Platform and future versions of Splunk Cloud Platform and Splunk Enterprise.
To determine if you have any HTML dashboards, check the following directories:
- $SPLUNK_HOME/etc/apps/appname/local/data/ui/html/
- $SPLUNK_HOME/etc/users/username/appname/local/data/ui/html/
If you have any HTML files located in these directories, then those files qualify as HTML dashboards. Replace your HTML dashboards with Dashboard Studio dashboards, Simple XML dashboards, or single-page applications.
Rebuild in Dashboard Studio
Rebuild your HTML dashboards in Dashboard Studio. Dashboards created or rebuilt in Dashboard Studio don't need updates for jQuery 3.5.
For more information about Dashboard Studio, see What is the Splunk Dashboard Studio? in the Splunk Dashboard Studio manual.
Rebuild as Simple XML with custom JavaScript
If Dashboard Studio is insufficient to replicate the functionality of your HTML dashboards, rebuild any remaining HTML dashboards as Simple XML dashboards with custom JavaScript. Ensure that your new Simple XML dashboards rely on jQuery 3.5 or higher.
For more information about building Simple XML dashboards, see Modify dashboards using Simple XML extensions.
Write a single-page application
If you cannot replicate your HTML dashboards with either Dashboard Studio or a Simple XML dashboard with custom JavaScript, you can write an single-page application (SPA) and fully package it with all of its dependencies. For this option, take the following steps:
Move the HTML file, such as myfile.html, to the appserver/static/template directory.
Create a view XML file in the data/ui/views directory, such as myview.xml.
Add the following line to your view XML file:
``` <view template="<app-name>:/static/template/myfile.html" type="html"></view> ```
For more information about single-page applications, see @splunk/react-page.
Ensure that your app passes AppInspect checks
If you want to check that an app is still compatible with Splunk Cloud, vet the app using the Splunk AppInspect API. See Vet apps and add-ons for Splunk Cloud for more details about the Splunk AppInspect process. You can use the Splunk AppInspect API with the jquery
tag specified to check if your app uses jQuery. Note the following jQuery-related checks:
Check | What it does | How to remove the warning |
---|---|---|
check_simplexml_standards_version | Returns a failure result if the Simple XML dashboard version is set to 1.0. Simple XML dashboards with the version="1.0" setting, or with no version explicitly set, have a transitive dependency on jQuery versions lower than 3.5. | Set the version attribute in the root node of your Simple XML dashboards to version="1.1" . |
check_hotlinking_splunk_web_libraries | Returns a failure result if your app imports libraries from Splunk Web. Your app might encounter issues when Splunk Web updates these libraries to jQuery 3.5. | Embed the front-end resources that your app needs in the appserver/static directory instead. |
check_html_dashboards | Returns a failure result if your app contains any HTML dashboards. | Rebuild your HTML dashboards, and then remove the HTML files in the /local/data/ui/html/ directories. |
Manually verify that you've completed updating your apps to jQuery 3.5
It is the app developer's responsibility to test apps on Splunk Enterprise version 8.2 or higher, where jQuery is updated to version 3.5 or higher. Even if Splunk AppInspect doesn't find any issues with your app, your app might still need updates for jQuery 3.5. Check your app manually to see if it has any dependencies on lower versions of jQuery.