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
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...