splunk-events
Advanced tools
Comparing version 1.2.3 to 1.3.0-beta.0
{ | ||
"name": "splunk-events", | ||
"version": "1.2.3", | ||
"version": "1.3.0-beta.0", | ||
"description": "Javascript lib to create Splunk Logs via HTTP", | ||
@@ -5,0 +5,0 @@ "main": "SplunkEvents.js", |
@@ -32,3 +32,3 @@ # Splunk Events | ||
'WeaponConstruction', | ||
'DeathStar' | ||
'DeathStar', | ||
{ username: 'vader'} | ||
@@ -54,3 +54,3 @@ ); | ||
'WeaponConstruction', | ||
'DeathStar' | ||
'DeathStar', | ||
{ username: 'vader'} | ||
@@ -90,3 +90,3 @@ ); | ||
// Max time to wait until flush events. Requires 'autoFlush' option. | ||
debounceMaxWait: 5000 //default | ||
debounceMaxWait: 5000, //default | ||
@@ -143,3 +143,3 @@ // Fetcher to do Splunk Events requests | ||
By default this lib doesn't have any dependencies for the newer browsers (it tries to use Fetch API) | ||
By default this lib doesn't have any dependencies for the newer browsers (it tries to use Fetch API). | ||
@@ -192,3 +192,48 @@ But to make it work on old browsers and Node you must use axios (0.13+) as a dependency by installing it (```npm install --save axios```) and setting it on Splunk events config: | ||
``` | ||
------- | ||
### Using in VTEX IO (node app example) | ||
Insert your splunk endpoint in your app policies (located at manifest.json) like so: | ||
```json | ||
{ | ||
"policies": [ | ||
{ | ||
"name": "outbound-access", | ||
"attrs": { | ||
"host": "YOUR_SPLUNK_ENDPOINT", | ||
"path": "*" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
If your endpoint has a port, you don't need to add it here. The protocol neither. Just the host... | ||
Then you have to create a new fetcher or tweak your if you already have one. | ||
This is to add headers so IO can properly proxy the request... | ||
```javascript | ||
function splunkCustomFetcher(context) { | ||
const headers = context.headers || {} | ||
return axios({ | ||
...context, | ||
headers: { | ||
...headers, | ||
// this authtoken comes from your app's ColossusContext | ||
'Proxy-Authorization': 'YOUR_AUTH_TOKEN', | ||
// here you can proxy to https and add ports if you need to | ||
'X-Vtex-Proxy-To': `https://${YOUR_SPLUNK_ENDPOINT}:8080`, | ||
} | ||
}) | ||
} | ||
``` | ||
Finally you can configure your splunk cient like so: | ||
```javascript | ||
splunkEvents.config({ | ||
// add your endpoint with http protocol and no ports, let IO do the proxying, trust the headers... | ||
endpoint: `http://${SPLUNK_ENDPOINT}`, | ||
request: splunkCustomFetcher, | ||
token: 'YOUR_TOKEN_HERE', | ||
}) | ||
``` | ||
------- | ||
@@ -195,0 +240,0 @@ ### Splunk Documentation |
@@ -100,2 +100,3 @@ 'use strict'; | ||
host: _this.host, | ||
time: +new Date(), | ||
event: parsedEvent | ||
@@ -102,0 +103,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
214
255
16318
3
2
2