I'm using a free Splunk instance to develop dashboard mostly with simple XML before I deploy it to the production system. The trial license of the free Splunk instance has expired. I can still use ...
See more...
I'm using a free Splunk instance to develop dashboard mostly with simple XML before I deploy it to the production system. The trial license of the free Splunk instance has expired. I can still use it for the development. However, when I tried to use JavaScript to extend a dashboard, I could not get the JavaScript working, in the sense that I don't see the print out statement executed as I could not see the print out on the web console. I only got the following error message: "common.js:1063 GET http://l-yshen:8000/en-US/splunkd/__raw/servicesNS/admin/search/alerts/alert_actions?output_mode=json&search=(is_custom%3D1+OR+name%3D%22email%22+OR+name%3D%22script%22+OR+name%3D%22lookup%22)+AND+disabled!%3D1&count=1000&_=1602204254014 402 (Payment Required)". I wonder the meaning of the error message? I guess that it might have something related to payment/license. The javascript file in question common.js is not of mine, probably from Splunk's own. Any suggestion how I can get my javascript running, or how to investigate the root cause of its not running? I wish to learn how to find any response or clue of my mistakes. Here is the script that I having difficulty with: require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
],
function($,_,mvc){
var multi1 = mvc.Components.get("multi1")
multi1.on("change",function(){
current_val = multi1.val()
console.log("Current Vals: " + current_val)
var first_choice_value = multi1.options.choices[0].value;
if (current_val.length > 1 && current_val.indexOf(first_choice_value) == 0) {
multi1.val(_.without(current_val, first_choice_value));
}
if (current_val.length > 1 && current_val.indexOf(first_choice_value) > 0) {
multi1.val([first_choice_value]);
}
})
}
)
© It's copied from here: https://www.youtube.com/watch?v=kQLV9AOL-FE&t=503s