Giter Club home page Giter Club logo

winston-dynamodb's Introduction

DynamoDB Transport for Winston

A DynamoDB transport for winston.

Usage

  var winston = require('winston');
  
  require('winston-dynamodb').DynamoDB;
  
  winston.add(winston.transports.DynamoDB, options);

Options

accessKeyId     : your AWS access key id
secretAccessKey : your AWS secret access key
region          : the region where the domain is hosted
useEnvironment  : use process.env values for AWS access, secret, & region
tableName       : DynamoDB table name
dynamoDoc       : if this is set to true, the *meta* parameter will be stored as a subobject using DynamoDB's DocumentClient rather than as a JSON string.

Prerequisite

Make a table with tableName

The table schema depends on how you intend to use it.

Simplest

The table should have

  • hash key: (String) level
  • range key: (String) timestamp

Note: Timestamp has a millisecond resolution. So whether this key setup will work depends on how many log messages you expect.

That is, the uniqueness of level + timestamp means max: 1 log message of a given level per millisecond.

It is nice to have it as a range key for queries.

More Robust

To ensure you can log as many messages as you like, alternatively use:

  • hash key: (String) id (Will be a uuid)
  • range key: (String) timestamp

Using the id as hash ensures that all log items will have unique keys and be included.

Region

Available Regions

  • us-east-1
  • us-west-1
  • us-west-2
  • eu-west-1
  • ap-northeast-1
  • ap-southeast-1
  • ap-southeast-2
  • sa-east-1

AWS Credentials

All of these options are values that you can find from your Amazon Web Services account: 'accessKeyId', 'secretAccessKey' and 'awsAccountId'.

Alternatively, pass in useEnvironment: true and the process.env values will be used.

(Functions in AWS Lambda environment and works with default AWS Credentials Global Configuration .config in other node environments.)

Installation

  $ npm install winston
  $ npm install winston-dynamodb

winston-dynamodb's People

Contributors

adamjuhasz avatar dave-gray101 avatar jeffreypriebe avatar jwchang0206 avatar nickiannone avatar raphaelmun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.