Splunk Dev

Full SplunkJS stack usage in SimpleXML extension

Simon
Contributor

Hi All,

I wanted to use the splunkjs.Service.* classes available in the SplunkJS stack in a SimpleXML extension.
But it looks like that in splunk, there's only the mvc part available of the stack:

ls /opt/splunk/share/splunk/search_mrsparkle/exposed/js/splunkjs:
total 332
drwxr-xr-x 2 splunk splunk   4096 Oct 23 02:06 compiled
-r--r--r-- 1 splunk splunk     73 Oct 23 01:33 config.js
drwxr-xr-x 4 splunk splunk   4096 Oct 23 02:06 contrib
drwxr-xr-x 2 splunk splunk   4096 Oct 23 02:06 css
drwxr-xr-x 2 splunk splunk   4096 Oct 23 02:06 generated
drwxr-xr-x 7 splunk splunk   4096 Oct 23 02:06 mvc
-r--r--r-- 1 splunk splunk    109 Oct 23 01:33 mvc.js
-r--r--r-- 1 splunk splunk   7632 Oct 23 01:33 preload.js
-r--r--r-- 1 splunk splunk  19531 Oct 23 01:33 ready.js
-r--r--r-- 1 splunk splunk 234494 Oct 23 01:33 splunk.js
-r--r--r-- 1 splunk splunk  42089 Oct 23 01:33 splunk.min.js

Can I just add the complete SplunkJS stack to my app and load it with requirejs or do I get any conflicts?

Thanks,
Simon

0 Karma

whatdaface
Engager

Following code worked for me:

  var service = mvc.createService();
  var savedSearches = service.savedSearches();

  savedSearches.fetch(function(err, mySavedSearches) {
            // Retrieve a specific saved search
            var mySavedSearch = mySavedSearches.item("saved_search_name");

            // Display some properties
            console.log("Name:                " + mySavedSearch.name);
            console.log("Query:               " + mySavedSearch.properties().search);
            console.log("Description:         " + mySavedSearch.properties().description);
            console.log("Scheduled:           " + mySavedSearch.properties().is_scheduled);
            console.log("Next scheduled time: " + mySavedSearch.properties().next_scheduled_time);
        });
0 Karma

whatdaface
Engager

I'm also interested in using services part of API and cannot find information about it so far.
Have you found out proper way to achieve this?

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...