splunk-events
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "splunk-events", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Javascript lib to create Splunk Logs via HTTP", | ||
@@ -12,2 +12,3 @@ "main": "SplunkEvents.js", | ||
"devDependencies": { | ||
"@vtex/prettier-config": "^0.1.4", | ||
"babel": "^6.23.0", | ||
@@ -21,3 +22,5 @@ "babel-cli": "^6.26.0", | ||
"babel-preset-stage-2": "^6.24.1", | ||
"eslint": "^4.12.1" | ||
"eslint": "6.8.0", | ||
"eslint-config-vtex": "^12.3.2", | ||
"prettier": "^2.0.4" | ||
}, | ||
@@ -42,2 +45,5 @@ "contributors": [ | ||
"name": "Gustavo Rosolem" | ||
}, | ||
{ | ||
"name": "Gabriel Vincent" | ||
} | ||
@@ -44,0 +50,0 @@ ], |
@@ -94,3 +94,5 @@ # Splunk Events | ||
// Fetcher to do Splunk Events requests | ||
request: function with axios signature that uses global Fetch API by default // default (see more details below) | ||
request: ({url, method, data, headers, responseType}) => { | ||
// a function with the same signature as `axios` that uses global Fetch API by default | ||
}, // default (see more details below) | ||
@@ -108,6 +110,9 @@ // If the request fail, retry to send events using the debounced flush function | ||
source: 'splunkeventsjs', //default | ||
// Wether or not Splunk Events should parse the event data with the function `parseEventData` | ||
shouldParseEventData: true // default | ||
} | ||
``` | ||
#### logEvent(level, type, workflowType, workflowInstance, event) | ||
#### logEvent(level, type, workflowType, workflowInstance, eventData, account) | ||
@@ -122,5 +127,5 @@ 'level' is the criticality of the event ('Critical','Important','Debug'). | ||
'event' is an object containing your custom data to send to Splunk. This object should be flat and the properties with 'null' or 'undefined' value will be **omitted**. | ||
'eventData' is an object containing your custom data to send to Splunk. This object should be flat and properties with a 'null' or 'undefined' value will be **omitted**. | ||
'account' is the accountName (e.g. 'dreamstore','gatewayqa','instoreqa'). | ||
'account' is the `accountName` (e.g. 'dreamstore','gatewayqa','instoreqa'). | ||
@@ -127,0 +132,0 @@ if 'injectAditionalInfo' is set to true, this function adds some default data to the event |
@@ -81,5 +81,6 @@ 'use strict'; | ||
this.logEvent = function (level, type, workflowType, workflowInstance, event, account) { | ||
_this.validateEvent(event); | ||
var parsedEvent = _this.parseEventData({ | ||
this.logEvent = function (level, type, workflowType, workflowInstance, eventData, account) { | ||
_this.validateEvent(eventData); | ||
var eventObj = _extends({ | ||
level: level, | ||
@@ -90,10 +91,5 @@ type: type, | ||
account: account | ||
}); | ||
}, eventData, _this.injectAditionalInfo ? _this.getAdditionalInfo() : {}); | ||
var event = _this.shouldParseEventData ? _this.parseEventData(eventObj) : eventObj; | ||
parsedEvent += _this.parseEventData(event); | ||
if (_this.injectAditionalInfo) { | ||
parsedEvent += _this.getAdditionalInfo(); | ||
} | ||
var data = _extends({ | ||
@@ -103,3 +99,3 @@ sourcetype: _this.source, | ||
}, _this.injectTimestamp && { time: +new Date() }, { | ||
event: parsedEvent | ||
event: event | ||
}); | ||
@@ -184,2 +180,3 @@ | ||
this.injectTimestamp = _config.injectTimestamp !== undefined ? _config.injectTimestamp : false; | ||
this.shouldParseEventData = _config.shouldParseEventData !== undefined ? _config.shouldParseEventData : true; | ||
this.headers = { | ||
@@ -186,0 +183,0 @@ Authorization: 'Splunk ' + this.token |
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
17456
5
263
12
213