Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ft-next-splunk-logger

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ft-next-splunk-logger

Log stuff Directly to splunk

  • 1.6.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Weekly downloads
 
Created
Source

next-splunk-logger

Logs stuff directly to splunk.

Prerequites

Requires a SPLUNK_URL environment variable to send stuff to. If you don't have one, talk to someone.

Usage

npm install --save ft-next-splunk-logger

The logger works pretty much the same as the debug module.

var log = require('ft-next-splunk-logger')('my-app-name');

log('Some stuff');

It will stick the app name and a timestamp at the beginnig of each log so the above will become

my-app-name 2015-05-30T12:54:54.479Z Some stuff

Like debug and console.log in node it uses util.format under the hood if the first arg is a string

log('here is a %s and %j', 'string', {foo:'bar'})

becomes:

here is a string and {"foo":"bar"}
	

Apparently splunk can parse json so the above should work well. But to make it easier if you pass just an object it will be formatted in the easiet way for splunk:

log({foo:'here is a string'})

becomes

foo="here is a string"

You can also pass it errors (but please don't, send them to sentry or somewhere useful):

log(new Error('bar'));

becomes:

Error: bar

Formatting Options

When passing a string as the first argument, the following placeholders can be used:

  • %s Will replace the argument using String(arg) - objects will appear as 'Object object' or similar
  • %d Will replace the argument using Number(arg) - anything that is not a number will appear as "NaN"
  • %j Will replace the argument using JSON.stringify(arg) - will throw an error if it doesn't get an a object
  • %o Will replace the argument using the splunk-friendly name=value style - will probably thrown an error if not given an object

FAQs

Package last updated on 19 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc