I'm creating a node script to connect to splunk and retrieve data using a one shot search. However, I've found that the javascript SDK isn't successfully allowing me to connect to my splunk account. I'm trying to connect to splunk.medu.com with the port 8000, with an account linked to a larger company, and yet I'm receiving login errors when doing so. I've read through all of the javascript SDK pages trying to resolve this problem and have tried many iterations of port, server, username, and password options for the login, and nothing so far has worked. This is the code I've been using:
var splunkjs = require('splunk-sdk');
var service = new splunkjs.Service({
username: "[username removed]",
password:"[password removed]",
scheme:"http",
host:"splunk.medu.com",
port:"8000",
version:"5.0"
});
service.oneshotSearch("search ERROR", {}, function(err, results) {
if(err) console.log("ERROR!: " + err);
else console.log("RESULTS: " + results);
console.log(err);
});
The login errors I receive lead me to an HTML page with a 404 error: The path \'/en-US/services/auth/login\' was not found. It says that the server is running, and that I am connected to the Splunk system (You are using splunk.medu.com:8000, which is connected to splunkd @143156 at https://127.0.0.1:8089 on Thu Jun 20 17:05:12 2013.), but that it can't login because of this missing page.
Any help would be greatly appreciated. Thanks!
pretty sure the issue was answered below.
I am having the same exact problem.. Was this issue ever resolved?
You're using the wrong port/URL. http port 8000 is the web UI. The API is on https port 8089, as suggested by your error message.