1.2.0 • Published 5 years ago

bunyan-amqp-logger v1.2.0

Weekly downloads
61
License
MIT
Repository
github
Last release
5 years ago

AMQP stream for Bunyan

Build Status

AMQP stream for the Bunyan logger

Installation

$ npm install bunyan-amqp-logger

Usage

"use strict";

var bunyan = require('bunyan');
var bunyanamqp = require('bunyan-amqp-logger');

var amq_stream = bunyanamqp.createStream({
    login : 'admin',
    password : 'UbpdMksr0ons',
    exchange : {
        routingKey : 'logs'
    }
}).on('connect', function () {
    console.log("Connected to amqp");
}).on('close', function (e) {
    console.log("Closed connection to amqp");
}).on('error', console.log);


var log = bunyan.createLogger({
    name : 'example',
    streams : [{
        level : 'debug',
        stream : process.stdout
    }, {
        level : 'debug',
        type : 'raw',
        stream : amq_stream
    }]
});

Configuration

A raw bunyan stream can be created using the module createStream(options)method.

The options object accepts the following fields:

ParameterTypeDefaultDescription
hoststringlocalhostAMQP host
portnumber5672AMQP port
vhoststring/AMQP virtual host
loginstringguestAMQP username
passwordstringguestAMQP password
sslEnablebooleanfalseEnable AMQP SSL
sslKeystring''AMQP SSL private key file path
sslCertstring''AMQP SSL certificate file path
sslCAstring''AMQP SSL CA file path
sslRejectUnauthorizedbooleantrueVerify AMQP SSL certificate against CA
exchangeobjectundefinedAMQP exchange options
levelstringinfoMessage level
serverstringos.hostname()Message source server
applicationstringprocess.titleMessage source application
pidstringprocess.pidMessage pid
tagsstring array["bunyan"]Message tags
typestringundefinedMessage type
bufferSizenumber100Outstanding message buffer size
messageFormatterfunctionundefinedOptional message formatting function

The exchange object accepts the following fields:

ParameterTypeDefaultDescription
namestringundefinedAMQP exchange name
routingKeystringmessage.levelAMQP message routing key
propertiesobject{}AMQP exchange options

Events

The stream will emit open, close and error events from the underlying AMQP connection.

Credits

This module is heavily based on bunyan-logstash-amqp.

1.2.0

5 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.0

8 years ago