Socket
Socket
Sign inDemoInstall

bunyan-syslog

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-syslog - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

4

lib/index.js

@@ -11,3 +11,3 @@ // Copyright 2013 Mark Cavage, Inc. All rights reserved.

///--- Globals
// --- Globals

@@ -39,3 +39,3 @@ var FACILITY = {

///--- Exports
// --- Exports

@@ -42,0 +42,0 @@ module.exports = {

// Copyright 2013 Mark Cavage, Inc. All rights reserved.
var dgram = require('dgram');
var os = require('os');

@@ -14,3 +13,3 @@ var Stream = require('stream').Stream;

///--- Globals
// --- Globals

@@ -21,9 +20,11 @@ var sprintf = util.format;

// Harcoded from https://github.com/trentm/node-bunyan so this module
// can have minimal dependencies
/*
* Harcoded from https://github.com/trentm/node-bunyan so this module
* can have minimal dependencies.
*/
var bunyan = {
FATAL: 60,
ERROR: 50,
WARN: 40,
INFO: 30,
WARN: 40,
INFO: 30,
DEBUG: 20,

@@ -34,3 +35,3 @@ TRACE: 10,

var seen = [];
function bunyanCycles(k, v) {
function bunyanCycles(_, v) {
if (!v || typeof (v) !== 'object') {

@@ -51,3 +52,4 @@ return (v);

// Syslog Levels
/* Syslog Levels */
/* eslint-disable */
var LOG_EMERG = 0;

@@ -61,5 +63,6 @@ var LOG_ALERT = 1;

var LOG_DEBUG = 7;
/* eslint-enable */
///--- Helpers
// --- Helpers

@@ -102,3 +105,3 @@ // Translates a Bunyan level into a syslog level

///--- API
// --- API

@@ -138,4 +141,5 @@ function SyslogStream(opts) {

SyslogStream.prototype.end = function end() {
if (arguments.length > 0)
if (arguments.length > 0) {
this.write.apply(this, Array.prototype.slice.call(arguments));
}

@@ -148,4 +152,5 @@ this.writable = false;

SyslogStream.prototype.write = function write(r) {
if (!this.writable)
if (!this.writable) {
throw new Error('SyslogStream has been ended already');
}

@@ -189,6 +194,8 @@ var h;

var str = '[object SyslogStream<facility=' + this.facility;
if (this.host)
if (this.host) {
str += ', host=' + this.host;
if (this.port)
}
if (this.port) {
str += ', port=' + this.port;
}
if (!/^Sys/.test(this.constructor.name)) {

@@ -195,0 +202,0 @@ str += ', proto=' +

@@ -13,3 +13,3 @@ // Copyright 2013 Mark Cavage, Inc. All rights reserved.

///--- Globals
// --- Globals

@@ -26,3 +26,3 @@ var PROXY_EVENTS = [

///--- Helpers
// --- Helpers

@@ -49,3 +49,3 @@ function createSocket(opts) {

///--- API
// --- API

@@ -78,4 +78,5 @@ function TCPStream(opts) {

self.socket.removeAllListeners('error');
if (self.socket.destroy)
if (self.socket.destroy) {
self.socket.destroy();
}
}

@@ -82,0 +83,0 @@

@@ -13,3 +13,3 @@ // Copyright 2013 Mark Cavage, Inc. All rights reserved.

///--- API
// --- API

@@ -54,4 +54,5 @@ function UDPStream(opts) {

s.send(buf, 0, buf.length, this.port, this.host, function (err) {
if (err)
if (err) {
self.emit('error', err);
}

@@ -58,0 +59,0 @@ self._pending--;

{
"name": "bunyan-syslog",
"description": "Syslog Stream for Bunyan",
"version": "0.3.1",
"version": "0.3.2",
"author": "Mark Cavage",

@@ -10,14 +10,18 @@ "license": "MIT",

"type": "git",
"url": "git://github.com/mcavage/node-bunyan-syslog.git"
"url": "git://github.com/joyent/node-bunyan-syslog.git"
},
"dependencies": {
"assert-plus": "0.1.5",
"nan": "2.1.x"
"nan": "^2.10.0"
},
"devDependencies": {
"bunyan": "1.5.x",
"tap": "0.6.0"
"bunyan": "^1.8.12",
"istanbul": "^0.3.6",
"faucet": "0.0.1",
"tape": "^3.5.0",
"eslint": "^4.13.1",
"eslint-plugin-joyent": "~2.1.0"
},
"scripts": {
"test": "tap test"
"test": "./node_modules/.bin/istanbul cover --print none test/run.js"
},

@@ -24,0 +28,0 @@ "engines": {

@@ -30,2 +30,3 @@ bunyan-syslog is a stream for [bunyan](https://github.com/trentm/node-bunyan)

```
That's pretty much it. You create a syslog stream, and point it at a syslog

@@ -37,2 +38,20 @@ server (UDP by default; you can force TCP by setting `type: tcp` in the

If you want your logs to be in the normal bunyan format, `rsyslog` allows you to
setup a template to format it as just the JSON object:
```
template(name="bunyan" type="string"
string="%msg:R,ERE,1,FIELD:(\\{.*\\})--end%\n")
local0.* /var/log/application.log;bunyan
```
You can also write this using the older `$template` syntax:
```
$template bunyan,"%msg:R,ERE,1,FIELD:(\{.*\})--end%\n"
local0.* /var/log/application.log;bunyan
```
## Mappings

@@ -58,4 +77,29 @@

## Running the test suite
You can run the test suite using the provided `rsyslog` configuration:
```
$ rsyslogd -f ./test/rsyslog.conf -i ./test.pid -u $USER
$ make test
$ kill $(cat test.pid)
```
If you have an older `rsyslog` installed, you can adjust it to use the legacy
syntax:
```
$ModLoad imudp
$ModLoad imtcp
$UDPServerAddress 127.0.0.1
$UDPServerRun 10514
$InputTCPServerRun 10514
```
Note that when run this way, the TCP socket will listen on `0.0.0.0`.
# License
MIT.
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