I am not able to login to splunk using javascript sdk.
I have done everything as per the document .
copied xmljson to splunk apps.
Tried mentioning port as 8000 and 8089.
installed node.
The slient side code is as follows:
How to start a Splunk session
<script type="text/javascript" charset="utf-8">
function displayApps() {
var http = new splunkjs.ProxyHttp("/proxy");
// Create a Service instance and log in
var service = new splunkjs.Service(http, {
username:"admin",
password:"kav$tim1",
scheme:"http",
host:"localhost",
port:"8089",
version:"5.0"
});
// Verify we logged in
// First, we log in
service.login(function(err, success) {
// We check for both errors in the connection as well
// as if the login itself failed.
if (err || !success) {
console.log("Error in logging in");
done(err || "Login failed");
return;
}
// Print installed apps to the console to verify login
service.apps().fetch(function(err, apps) {
if (err) {
console.log("There was an error retrieving the list of applications:", err);
done(err);
return;
}
var myapps = "";
var appsList = apps.list();
console.log("Applications:");
for(var i = 0; i < appsList.length; i++) {
myapps += "App " + i + ": " + appsList[i].name + "<br/>"
}
document.getElementById("applist").innerHTML=myapps;
});
}
</script>
Log in and list apps
Give me a suggestion
... View more