Setup everything as per the docs, changed the user name and password but when click on Run button on the first example, it says "Error in logging in".
When checked developer console, it resulted in this error page
The path '/en-US/services/json/v2/services/auth/login' was not found.
We have "Splunk 4.3 build 115073." installed.
Please advice how I should make these examples run.
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:
<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>
Give me a suggestion
Make sure you set the port to the management port (8089 by default) rather than the webport (8000, default) as this was my problem when I got that error.
The javascript sdk examples can only be tested from a webserver. To test them from client, install and use node.js. Try this link "http://dev.splunk.com/view/SP-CAAAEDC"
The xml2json app is included with the JavaScript SDK, and needs to be copied to your Splunk apps directory. Instructions about setting up this app are here:
http://dev.splunk.com/view/SP-CAAAEFN
Done as advised but still the same error. this is how the
the X-ProxyDestination in the request header looks like
http://
Yes I was trying the wrong port. Thanks for that. But now I am getting 500 Internal Server Error with response as {"code":"ECONNRESET"}. Do I need to install xml2json app on the splunk server? Where do I get that?
A couple of quick questions: