Hi All,
We are new to splunk. We are trying to develop splunk app with javascript sdk. We are facing issues in running examples which are available in side sdk. we had installed splunk 6.0 and node.js.
We are getting errors in search app. Error in listing apps. could any one can provide us the directions in order to resolve the issue. Thanks in advance.Below is the code
var http = new splunkjs.ProxyHttp("/proxy");
3.
4. var service = new splunkjs.Service(http, {
5. username: username,
6. password: password,
7. scheme: scheme,
8. host: host,
9. port: port,
10. version: version
11. });
12.
13. // First, we log in
14. service.login(function(err, success){
15. // We check for both errors in the connection as well- as if the login itself failed.
16. if (err || !success) {
17. console.log("Error in logging");
18. done(err || "Login failed");
19. return;
20. }
21.
22. // Now that we're logged in, let's get a listing of all the apps.
23. service.apps().fetch(function(err, apps){
24.
25.
26.
27. if (err){
28. console.log("There was an error retrieving the list of applications:", err);
29. alert("This is the error...", err);
30. done(err);
31. return;
32. }
33.
34.
35. var appsList = apps.list();
36. alert(" This is the length of apps..."+appsList.length);
37.
38. console.log("Applications:");
39. for(var i = 0; i < appsList.length; i++){
40. var app = appsList[i];
41. console.log(" App " + i + ": " + app.name);
42. }
43. done();
44. });
45. });
46.
Best Regards,
Siva Rama Prasad.G
... View more