A Winston transport for Amazon DynamoDB
A DynamoDB transport for winston.
var winston = ;DynamoDB;winston;
accessKeyId : your AWS access key idsecretAccessKey : your AWS secret access keyregion : the region where the domain is hosteduseEnvironment : use process.env values for AWS access, secret, & regiontableName : DynamoDB table namedynamoDoc : 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.
Make a table with
The table schema depends on how you intend to use it.
The table should have
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.
To ensure you can log as many messages as you like, alternatively use:
Using the id as hash ensures that all log items will have unique keys and be included.
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.)
$ npm install winston$ npm install winston-dynamodb