Skip to content

Bunyan stream for syslog listening at a unix datagram domain socket, such as /dev/log.

License

Notifications You must be signed in to change notification settings

shreyjain1994/bunyan-syslog-unixdgram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bunyan Syslog Unix Datagram

A syslog stream for bunyan that works without requiring any configuration to the syslog daemon.

In most UNIX systems, syslog is automatically configured to be listening at a UNIX datagram domain socket (most likely /var/log), so any messages sent there will be logged by syslog. This stream connects to datagram domain sockets, so unlike other bunyan syslog stream implementations, you won't have to go and change your syslog config file to enable a TCP/UDP server.

It just works, which makes it easier to use for beginners.

Installation

npm install bunyan-syslog-unixdgram

Usage

var bunyan = require('bunyan');
var SyslogStream = require('bunyan-syslog-unixdgram');

var stream = new SyslogStream({
    name: 'myAppName',
    facility: SyslogStream.facility.local6,
    path: '/dev/log'
});

var log = bunyan.createLogger({
	name: 'foo',
	streams: [ {
		level: 'debug',
		type: 'raw', // Always use 'raw' bunyan stream
		stream: stream
	}]
});

log.debug({foo: 'bar'}, 'hello %s', 'world');

Stream Options

An options object can be provided when instantiating the stream object. It can contain the following properties:

  1. name: name that is used in the tag portion of the syslog log messages header. Defaults to process.title || process.argv[0].
  2. facility: syslog facility for the log messages. Defaults to 1 (user facility).
  3. path: The path to the UNIX datagram domain socket to which the log messages will be sent. Defaults to /dev/log.

Mappings

This module maps bunyan levels to syslog levels as follows:

+--------+--------+
| Bunyan | Syslog |
+--------+--------+
| fatal  | emerg  |
+--------+--------+
| error  | error  |
+--------+--------+
| warn   | warn   |
+--------+--------+
| info   | info   |
+--------+--------+
| *      | debug  |
+--------+--------+

License

MIT.

About

Bunyan stream for syslog listening at a unix datagram domain socket, such as /dev/log.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published