0.3.0 • Published 10 years ago

bunyan-dynamodb v0.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

Bunyan DynamoDB Build Status

A Bunyan Stream for logging to a DynamoDB table.

Installation

npm install --save bunyan-dynamodb

Usage

var BunyanDynamoDb = require('bunyan-dynamodb');

var dynamoStream = new BunyanDynamoDb({
  accessKeyId: 'AWS_ACCESS_KEY_ID',          // required
  secretAccessKey: 'AWS_SECRET_ACCESS_KEY',  // required
  region: 'us-east-1',                       // required
  tableName: 'event_log',                    // name of table. defaults to event_log
  
  batchSize: 25                              // number of records to queue up before 
                                             //  sending. defaults to maximum, 25.

  hashKeyField: 'hostname'  // the property from the Bunyan log event to use as the 
                            // table's hash key. any top-level attribute may be 
                            // used. defaults to 'hostname'.  the value of 
                            // the hashkey field is always converted to a string.

  readCapacityUnits: 1,     // required: read and write capacity to provision table   
  writeCapacityUnits: 2,    // with. if table already exists will have no effect.
}); 


var logger = new bunyan.createLogger({ 
  name: 'app',
  streams: [{
    level: 'trace',
    type: 'raw',
    stream: dynamoStream,
  }],
});

Table Schema

The logger will create a DynamoDB table with the following fields:

NameTypeDescription
hostnameStringThe default hash key field. Value of the event's hostname field.
timestampNumericThe table's range key. A number based on the time field of the log event with a number and hostname appended to ensure uniqueness. ex: 20150714151724593.44001647.localhost
levelNumericValue of the event's level field.
messageStringValue of the msg field.
eventStringJSON stringified representation of the entire log event.
0.3.0

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago