Deployment Architecture

Is it possible to store some data directly in Splunk (not through some file) using the JavaScript SDK?

ektasiwani
Communicator

Hi ,

I have an external app where I am fetching data from Splunk and displaying a graph using the JavaScript SDK. Now I need to store some data (not file), like elements of an array.

I don't want to use any other database. Can I store array elements directly on Splunk (not file) using JavaScript SDK? I don't have this data stored on any file as its being created on the fly.

Thanks!

0 Karma

loggar
Explorer

You can write it directly to your index in Splunk ...

var service = mvc.createService();

var myindexes = service.indexes();

myindexes.fetch(function(err, myindexes) {

    var myindex = myindexes.item("nameofmyindex");

    myindex.submitEvent('my_events_to_write_into_splunk_index', {
        sourcetype: 'nameofsourcetype'
    }, function(err, result, myindex) {
        console.log("Submitted event: ", result);
    });
});
0 Karma

Richfez
SplunkTrust
SplunkTrust

I'm not an expert in this, but a couple of things came to mind as I read your question.

Have you looked into the HTTP Event Collector? Here's possibly a better resource for you on setting up HEC.

And I'm not sure why you don't want files. What's actually wrong with taking whatever data it is you want to save, serialize your data or normalize it in a fashion you can use log4XXX (or your own stuff, whatever) to write it to a file, then have Splunk monitor that file. Depending on what you need, you could have it write a CSV and use that as a lookup file, too.

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...