splunk-events
Advanced tools
Comparing version 1.2.2 to 1.2.3
{ | ||
"name": "splunk-events", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Javascript lib to create Splunk Logs via HTTP", | ||
@@ -5,0 +5,0 @@ "main": "SplunkEvents.js", |
@@ -77,3 +77,3 @@ 'use strict'; | ||
function SplunkEvents() { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -83,4 +83,4 @@ _classCallCheck(this, SplunkEvents); | ||
this.logEvent = function (level, type, workflowType, workflowInstance, event, account) { | ||
_this2.validateEvent(event); | ||
var parsedEvent = _this2.parseEventData({ | ||
_this.validateEvent(event); | ||
var parsedEvent = _this.parseEventData({ | ||
level: level, | ||
@@ -93,18 +93,18 @@ type: type, | ||
parsedEvent += _this2.parseEventData(event); | ||
parsedEvent += _this.parseEventData(event); | ||
if (_this2.injectAditionalInfo) { | ||
parsedEvent += _this2.getAdditionalInfo(); | ||
if (_this.injectAditionalInfo) { | ||
parsedEvent += _this.getAdditionalInfo(); | ||
} | ||
var data = { | ||
sourcetype: _this2.source, | ||
host: _this2.host, | ||
sourcetype: _this.source, | ||
host: _this.host, | ||
event: parsedEvent | ||
}; | ||
_this2.events.push(data); | ||
_this.events.push(data); | ||
if (_this2.autoFlush) { | ||
_this2.debouncedFlush(); | ||
if (_this.autoFlush) { | ||
_this.debouncedFlush(); | ||
} | ||
@@ -114,15 +114,15 @@ }; | ||
this.flush = function () { | ||
if (_this2.isSendingEvents) { | ||
_this2.debouncedFlush(); | ||
if (_this.isSendingEvents) { | ||
_this.debouncedFlush(); | ||
return; | ||
} | ||
_this2.validateConfig(); | ||
_this.validateConfig(); | ||
_this2.pendingEvents = [].concat(_this2.events); | ||
_this2.events = []; | ||
_this2.isSendingEvents = true; | ||
_this.pendingEvents = [].concat(_this.events); | ||
_this.events = []; | ||
_this.isSendingEvents = true; | ||
if (_this2.debug) { | ||
console.log('sending ' + _this2.pendingEvents.length + ' events to splunk'); | ||
if (_this.debug) { | ||
console.log('sending ' + _this.pendingEvents.length + ' events to splunk'); | ||
} | ||
@@ -134,28 +134,28 @@ | ||
var splunkBatchedFormattedEvents = _this2.formatEventsForSplunkBatch(_this2.pendingEvents); | ||
var splunkBatchedFormattedEvents = _this.formatEventsForSplunkBatch(_this.pendingEvents); | ||
_this2.request({ | ||
url: '' + _this2.endpoint + _this2.path, | ||
_this.request({ | ||
url: '' + _this.endpoint + _this.path, | ||
method: 'POST', | ||
data: splunkBatchedFormattedEvents, | ||
headers: _this2.headers, | ||
headers: _this.headers, | ||
responseType: 'json' | ||
}).then(function (response) { | ||
if (_this2.debug) { | ||
console.log(_this2.pendingEvents.length + ' events successfuly sent to splunk'); | ||
if (_this.debug) { | ||
console.log(_this.pendingEvents.length + ' events successfuly sent to splunk'); | ||
} | ||
_this2.pendingEvents = []; | ||
_this2.isSendingEvents = false; | ||
_this.pendingEvents = []; | ||
_this.isSendingEvents = false; | ||
}).catch(function (e) { | ||
_this2.events = _this2.events.concat(_this2.pendingEvents); | ||
_this2.pendingEvents = []; | ||
_this2.isSendingEvents = false; | ||
_this.events = _this.events.concat(_this.pendingEvents); | ||
_this.pendingEvents = []; | ||
_this.isSendingEvents = false; | ||
if (_this2.autoRetryFlush) { | ||
if (_this2.debug) { | ||
if (_this.autoRetryFlush) { | ||
if (_this.debug) { | ||
console.warn('Error sending events to splunk. Retrying in 5 seconds.', e); | ||
} | ||
_this2.debouncedFlush(); | ||
_this.debouncedFlush(); | ||
} else { | ||
if (_this2.debug) { | ||
if (_this.debug) { | ||
console.warn('Error sending events to splunk.', e); | ||
@@ -162,0 +162,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100503