Security

Node / Javascript SDK for Splunk Not Allowing Login

8ksangani
Engager

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!

Tags (1)

gkanapathy
Splunk Employee
Splunk Employee

pretty sure the issue was answered below.

0 Karma

rickshaw12
Explorer

I am having the same exact problem.. Was this issue ever resolved?

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

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.

Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...