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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...