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

github.com/titarenko/logstash-udp

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/titarenko/logstash-udp

  • v0.0.0-20150714145332-9633d9fd0f87
  • Source
  • Go
  • Socket score

Version published
Created
Source

logstash-udp

Your log messages go to logstash UDP input (almost) without any overhead.

Installation

npm i lsudp --save

Usage

Somewhere in the app entry module:

var logstash = require('lsudp');
logstash.init({
	appName: 'my-app-1',
	host: 'logstash.mycompany.com',
	port: 7777
});

In any module then:

var logstash = require('lsudp')('my-folder/my-module');
logstash.error('oh no! json: %j, number: %d, string: %s', {everything: 'is broken'}, 1000, 'times');

Will cause logstash receive following over UDP:

{
	"@timestamp": "Date as ISO string here",
	"type": "my-app-1",
	"env": "NODE_ENV value here",
	"source": "my-folder/my-module",
	"level": "ERROR",
	"message": "oh no! json: {\"everything\": \"is broken\"}, number: 1000, string: times"
}

If you want to log structured data, then:

logstash.warning('warning!', mydata);

Resulting message object will have mydata assigned as value of property data.

This still works if you want to use placeholders inside message:

logstash.debug('my %s message %d', 'formatted', 2, { my_custom: 'structured data' });

Notes

If lsudp encounters transport level error, it will output it to stderr in stringified form.

License

MIT

FAQs

Package last updated on 14 Jul 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