Deployment Architecture

Setup.xml with inline script or application.js

cresthemal
New Member

Hi,

I want to know which is the best way to write script with setup page. I am aware that application.js will be loaded automatically in the setup page and its the easy way to write some code there, but application.js also get loaded in other places so does this harm what I have written there? I also find that we can write inline script with setup.xml as well. So can some one give brief answer on this what are the pros and cons using application.js over inline script and which is the best way to do write script in setup page?

Thanks in advance.

0 Karma

rjthibod
Champion

According to this question and one of its answers (https://answers.splunk.com/answers/4106/include-jquery-into-setup-xml.html), you may be able to put the JS directly inline via the <script>...</script> tags.

I cannot find any Splunk documentation that mentions another way to load JS files, but you may be able to use a method that is available to HTML dashboards by trying to load a JS file in your app with the following line. I have not tested it, but this is how one includes JS files in HTML dashboards.

<script src="/static/app/<YOUR_APP_NAME>/<JS_FILE_NAME>.js"></script>

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...