Splunk Dev

How to login into splunk instance with admin user credentials via javascript sdk , what are the prerequisites we need

ajayabburi508
Path Finder

Hi All ,

I am trying to login into splunk instance  with javascript sdk  credentials but it is not working well.

var http = new splunkjs.ProxyHttp("/proxy");

        // Create a Service instance and log in 
        var service = new splunkjs.Service(http, {
            username: "admin",
            password: "yourpassword",
            scheme: "https",
            host: "localhost",
            port:"8089",
            version:"5.0"
        });


        // Verify we logged in

        // Print installed apps to the console to verify login
        service.apps().fetch(function(err, apps) {
            if (err) {
                alert("Error listing apps");
                return;
            }

            var myapps = "";
            var appsList = apps.list();
            for(var i = 0; i < appsList.length; i++) {
                myapps += "App " + i + ": " + appsList[i].name + "<br/>"
            } 

            document.getElementById("applist").innerHTML=myapps;
        });

    }

 

 

Labels (1)
0 Karma

ajayabburi508
Path Finder

I am able to run one shot searches but it is taking auto login , but it should take admin credentials only.

Tags (1)
0 Karma
Get Updates on the Splunk Community!

New This Month - SLO Capabilities, APM Advanced Filtering & Usage Analytics Plus ...

More for SLO Management We’re continuing to expand the built-in SLO management experience in Splunk ...

Enterprise Security Content Update (ESCU) | New Releases

In June, the Splunk Threat Research Team had 2 releases of new security content via the Enterprise Security ...

Index This | What gets bigger the more you remove?

June 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...