Splunk Dev

Unable to connect to the splunk with javascript sdk example

disha
Contributor

Reference to the example http://dev.splunk.com/view/SP-CAAAEC9
I am running client side java script example.
first i hvae started the server:

node sdkdo runserver
Running server on port: 6969 -- Hit CTRL+C to exit

Then Saved this code to connect.html
Placed the file in splunk-sdk-javascript/example/browser folder
set the path location as

-

changed the login credentials as
var service = new splunkjs.Service(http, {
username: "admin",
password: "password",
scheme: "http",
host: "localhost",
port:"6969",
version:"5.0"
});

When running this in browser as http://localhost:6969/example/browser/connect.html
it says alert "Error listing apps".
In console I can see
http://localhost:6969/proxy/services/auth/login?output_mode=json 500 (Internal Server Error)

If i just click to open connect.html the URL becomes file:///C:/splunk-sdk-javascript/examples/browser/connect.html gives same alert but in console it says:
Failed to load resource: Resource failed to load file:///C:/proxy/services/auth/login?output_mode=json

Please help what I am missing.
Thanks,

Tags (1)
0 Karma

Rocket66
Communicator
0 Karma

Neeraj_Luthra
Splunk Employee
Splunk Employee

Assuming it is default Splunk installation, the port that you will need to connect to is 8089. 6969 is where the http server, node is listening.

0 Karma

jitendra0101
Engager

Please help. Every time I am getting error message as "Error Listing Apps".

0 Karma

Neeraj_Luthra
Splunk Employee
Splunk Employee

As long as you are using the "admin" user, the license shouldn't matter. Did you copy the xml2json folder as mentioned in my previous comment?

0 Karma

disha
Contributor

My license is expired..I am working on free splunk this week. That can be the reason?

0 Karma

Neeraj_Luthra
Splunk Employee
Splunk Employee

What version of Splunk are you running?

If you are running Splunk 4.x, you will also need the xml2json app which is shipped with the SDK. You will need to copy the folder to your Splunk apps directory (etc/apps/). Detailed instructions for this can be found at http://dev.splunk.com/view/SP-CAAAEFN.

0 Karma

disha
Contributor

with port:"8089" again it is not running.. showing error on console as:
POST http://localhost:6969/proxy/services/auth/login?output_mode=json 500 (Internal Server Error) jquery.min.js:4
Any Suggesstion?

0 Karma
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!

From Data to Insight: Announcing the Winners of the Splunk Dashboard Contest

Hi Splunkers, First off, thank you to everyone who participated in our very first From Data to Insight: The ...

Splunk Developers: Construct Your Future at the .conf26 Builder Bar

Calling all Splunk architects, platform admins, and app developers: the site is open, and the blueprints are ...

Quick connection discovery mode for forwarders

When a Splunk forwarder loses connectivity to its indexers, it does not always reconnect immediately. In many ...