1.0.1 • Published 4 years ago

splunk-emit v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Splunk Emit

JavaScript library to emit JSON "events" to splunk via a HEC
Includes native (win|mac|linux) cli


Support

  • Node

Setup

npm install splunk-emit

ES5 Example

const splunk_emit = require("splunk-emit");

const emitter = new splunk_emit.HEC_Emitter({
    debug : true,
    splunk_url : "{{target-SPLUNK_URL}}", //OR set environment var SPLUNK_URL
    splunk_hec : "{{target-SPLUNK_HEC}}" //OR set environment var SPLUNK_HEC
});

 let eventBatch = new splunk_emit.EventBatch({
        debug : true
    });
eventBatch.enableAutoFlush(emitter, 1); //1 sec flush

eventBatch.add( {
    name : "value",
    index : 1,
    text : "this ia an example"
} );

emitter.on( 'flush', () => {
    process.exit();
});

API


Cli