I am getting error: No session key available. Below is the node.js code in app.js. I'm getting the error at service.login() and then log the error. Please help.
var splunkjs = require('splunk-sdk'),
Class = splunkjs.Class,
utils = splunkjs.Utils,
Async = splunkjs.Async;
app.get('/splunk', function(request, response) {
// Create a Service instance and log in
var service = new splunkjs.Service({
scheme:"https",
host:"<internal splunk address host>",
port:"8089",
username:"dashboard",
password:"1234",
version:"4.0"
});
//var service = new splunkjs.Service({username: "admin", password: "changeme"});
service.login(function(err, success) {
if (err || !success) {
console.log('Error: ' + err);
}
console.log("Login was successful: " + success);
service.jobs().fetch(function(err, jobs) {
var jobList = jobs.list();
for(var i = 0; i < jobList.length; i++) {
console.log("Job " + i + ": " + jobList[i].sid);
}
});
});
});
... View more