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.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Event Series: Telemetry Pipeline Management

Balancing Scale and Spend: Gaining Control Over High-Volume Metrics in Splunk Observability Cloud As ...

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...

Deep insights, no barriers: Splunk Observability Cloud Free Edition

As software delivery cycles continue to accelerate, observability shouldn’t be a luxury — it should be a ...