{"_id":"@aneilbaboo/winston-cloudwatch","_rev":"2-f2f61141f5e0c5850f025c011f0cbe61","name":"@aneilbaboo/winston-cloudwatch","dist-tags":{"latest":"1.13.1"},"versions":{"1.13.0":{"name":"@aneilbaboo/winston-cloudwatch","version":"1.13.0","description":"Send logs to Amazon Cloudwatch using Winston.","keywords":["amazon","cloudwatch","winston","logging","log"],"main":"index.js","scripts":{"test":"make test","coveralls":"coveralls < ./coverage/lcov.info","update-dependencies":"npm-check-updates -ua && npm install"},"repository":{"type":"git","url":"git+https://github.com/lazywithclass/winston-cloudwatch.git"},"author":{"name":"me@lazywithclass.com"},"license":"MIT","typings":"typescript/winston-cloudwatch.d.ts","peerDependencies":{"winston":"^3.0.0-rc1"},"dependencies":{"async":"^2.6.0","aws-sdk":"^2.186.0","chalk":"^2.3.0","lodash.assign":"^4.2.0","lodash.find":"^4.6.0","lodash.isempty":"^4.4.0","proxy-agent":"^2.2.0"},"devDependencies":{"@types/node":"9.3.0","@types/winston":"2.3.7","clarify":"^2.1.0","coveralls":"^3.0.0","istanbul":"^0.4.5","mocha":"^5.0.0","mockery":"^2.1.0","npm-check-updates":"^2.14.0","should":"^13.2.1","sinon":"^4.2.0"},"gitHead":"bdae5a6194caaf23b0a9a51c27b5860da089270f","bugs":{"url":"https://github.com/lazywithclass/winston-cloudwatch/issues"},"homepage":"https://github.com/lazywithclass/winston-cloudwatch#readme","_id":"@aneilbaboo/winston-cloudwatch@1.13.0","_npmVersion":"5.8.0","_nodeVersion":"9.3.0","_npmUser":{"name":"aneilbaboo","email":"aneilmallavar@gmail.com"},"dist":{"integrity":"sha512-LDFfGP/8dVlvxehilOtnh5x75PnG7e0IJ6HRfVm3x0yUrhi5X1cy+0HWZCO2lC6ybO/RluZ1r8+rvPHZ3a4Gkg==","shasum":"6e483def44825ecae07f9961c866b39ab694f979","tarball":"https://registry.npmjs.org/@aneilbaboo/winston-cloudwatch/-/winston-cloudwatch-1.13.0.tgz","fileCount":22,"unpackedSize":54144,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa2sXbCRA9TVsSAnZWagAAs0kP+wTHKl85mRipJ+L+W7u+\noUKlBNgbhSHuaMJyC6dlXE+NnTrl+HmV7/qVHFd0u/x2q4q03XdkX3O/41ve\nGIHahoIXAvzpb0/0q2UUhjT0RX1f2qzJqGHoiZYo2jhV2CPDuekK4G3caRMy\npAJ7tiBSbwDwlg8ctY7nKS3jHRqcD4DkJ2WJkpU1MFzQ9e01r4J+woJzIHKH\nqPbBAf3sNPi6mHt840I/frXma/OIAAB5mRT5tfm6cobDEnGHckjeJk81LnjJ\nZr9cb4xmIoSkO86gJxfogFbAyFZDyNM4lo3pvCzkM/Aqu3yyu9stRfC3CHVr\nE13dZIgkSzcYtYsaQ4fTOFEKkSdeek3xw62gNvzVoJ1kGJtdC95RSvBFcGqE\nxBfdhhTQrlU9krYM+wPUSSy2gfAc3tcT+kbe8eoVG6P/05/ou11McQWAZTEf\nz5VtAGIMEPcZ8xJb+GT3t+PKN9QAOnc5+8IthKDcG21kGA3CdPTRNbTcWLAc\ndPUuw4CKlyy6Nm49hfcg8rkwJdlVPpShXxg/3lZd8lgeA9+441UlYAehbkBC\nbs92LdgN0NkRYDUKHwmOXa7GVCkHUKQnUvSPXLpLzX8pk7S6VdaPRt+KSzcc\neDLI6PlElNcaGTC4zJdLmTFpSXBbczYUKo996trLwwk5HE1mefxYbIk4/Cxz\n/zH1\r\n=zFJi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCoeyIw/SrEfVhZ0OEU/7M9xpp7meZx1zJ0O/YHoGYtgIgFPVz1zWVY/Q5b2UKeGsIBx+DJsyYvEXqH7flHFGMaVs="}]},"maintainers":[{"name":"aneilbaboo","email":"aneilmallavar@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/winston-cloudwatch_1.13.0_1524286938095_0.6263323779263865"},"_hasShrinkwrap":false},"1.13.1":{"name":"@aneilbaboo/winston-cloudwatch","version":"1.13.1","description":"Send logs to Amazon Cloudwatch using Winston.","keywords":["amazon","cloudwatch","winston","logging","log"],"main":"index.js","scripts":{"test":"make test","coveralls":"coveralls < ./coverage/lcov.info","update-dependencies":"npm-check-updates -ua && npm install"},"repository":{"type":"git","url":"git+https://github.com/lazywithclass/winston-cloudwatch.git"},"author":{"name":"me@lazywithclass.com"},"license":"MIT","typings":"typescript/winston-cloudwatch.d.ts","peerDependencies":{"winston":"^3.0.0-rc2"},"dependencies":{"async":"^2.6.0","aws-sdk":"^2.186.0","chalk":"^2.3.0","lodash.assign":"^4.2.0","lodash.find":"^4.6.0","lodash.isempty":"^4.4.0","proxy-agent":"^2.2.0"},"devDependencies":{"@types/node":"9.3.0","@types/winston":"2.3.7","clarify":"^2.1.0","coveralls":"^3.0.0","istanbul":"^0.4.5","mocha":"^5.0.0","mockery":"^2.1.0","npm-check-updates":"^2.14.0","should":"^13.2.1","sinon":"^4.2.0"},"gitHead":"bdae5a6194caaf23b0a9a51c27b5860da089270f","bugs":{"url":"https://github.com/lazywithclass/winston-cloudwatch/issues"},"homepage":"https://github.com/lazywithclass/winston-cloudwatch#readme","_id":"@aneilbaboo/winston-cloudwatch@1.13.1","_npmVersion":"5.8.0","_nodeVersion":"9.3.0","_npmUser":{"name":"aneilbaboo","email":"aneilmallavar@gmail.com"},"dist":{"integrity":"sha512-k0Rx6HedLOidhhE00TFg5Ql2vIWr3KAfPni7ZojTv10DbwZdivGockW/kRMFFBT669PsgK/0G3cFLW0Jo2ZK8w==","shasum":"f8e07f03e427bfed3aaea066784e649f886004d3","tarball":"https://registry.npmjs.org/@aneilbaboo/winston-cloudwatch/-/winston-cloudwatch-1.13.1.tgz","fileCount":22,"unpackedSize":54144,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa3Xn3CRA9TVsSAnZWagAARM8P/1zAj878Zh5FfdYSTg0B\n+UgD4uKQchV9hNkhRZAwBOoY4r7c+vjEJWq/slMEnR/8PSp6f8xYWA7l8h2p\ngkJo33kyiWju5+Z9Tul4A22jBlwc+ywVFW87UAwWyBAuGuVR4/Azc+QjC6lv\nTHLcchaLpcootEDhXuV5aIMiUd852sW7inGflrjLi0aVfx3rmiuktCssRzEY\nBSZo/bTmhmi9aSqK7OsIZ0XOq+hKCP2FVUbSeJX+Gtdh455+j43pjjQCg0g7\nv2SPtF+yrjWNElvOTNaxnLG4zB2YZ6SWmqZw8NQO1f7rM9iCBCqY86m3EmEO\nv1RTuf3gI17pdgFx0MsE3erCa4ujdWucTGLlTh2e0agddAROXOXBALJ0pEVY\neKNkO3uFhe9DwZZPErhS9ZhucfDEGp8zyd1gFvm5yThX5bpAg9OdlFVNHZt+\n+kEDVDkQ/KPrZLm+P6u7LMKnycCf2sDUIL3ciUQgVnH0qtQk2AQ2hWwK1j4p\n2Ty0FwwxYukhbKzq8g47pjBoYixB18wLbFsICyFik8kFiryV7Ji+ozdsIuF1\nqKB47hmzaKVQi583JP0VzM2qGqY0JEGko2fIRqsr+WiLJ+B4rSfi5uVjJtUP\nNxra+cWtlkXcmo+2kZQhvm3g+SUVhjOLFcsU/wgdb0a3HY0z+WFFPIL+JKke\nNXlC\r\n=+5oR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEZP3PSpbgURut4PkZEPhRcwhjGwc7fGj30xXFIfVjqgIhAOfu/2jwZoqOIavJbAP4LMy60P1YQI5qWMFiKlrbZE0c"}]},"maintainers":[{"name":"aneilbaboo","email":"aneilmallavar@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/winston-cloudwatch_1.13.1_1524464118105_0.9550056303746566"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-21T05:02:18.040Z","1.13.0":"2018-04-21T05:02:18.142Z","modified":"2022-04-04T14:04:53.601Z","1.13.1":"2018-04-23T06:15:18.164Z"},"maintainers":[{"name":"aneilbaboo","email":"aneilmallavar@gmail.com"}],"description":"Send logs to Amazon Cloudwatch using Winston.","homepage":"https://github.com/lazywithclass/winston-cloudwatch#readme","keywords":["amazon","cloudwatch","winston","logging","log"],"repository":{"type":"git","url":"git+https://github.com/lazywithclass/winston-cloudwatch.git"},"author":{"name":"me@lazywithclass.com"},"bugs":{"url":"https://github.com/lazywithclass/winston-cloudwatch/issues"},"license":"MIT","readme":"# winston-cloudwatch [v1.13.0](https://github.com/lazywithclass/winston-cloudwatch/blob/master/CHANGELOG.md#1130)\n\n[![Build Status](https://travis-ci.org/lazywithclass/winston-cloudwatch.svg?branch=master)](https://travis-ci.org/lazywithclass/winston-cloudwatch) [![Coverage Status](https://coveralls.io/repos/github/lazywithclass/winston-cloudwatch/badge.svg?branch=master)](https://coveralls.io/github/lazywithclass/winston-cloudwatch?branch=master) [![Dependency Status](https://david-dm.org/lazywithclass/winston-cloudwatch.svg)](https://david-dm.org/lazywithclass/winston-cloudwatch) [![dev dependencies](https://david-dm.org/lazywithclass/winston-cloudwatch/dev-status.svg)](https://david-dm.org/lazywithclass/winston-cloudwatch#info=devDependencies) [![peer dependencies](https://david-dm.org/lazywithclass/winston-cloudwatch/peer-status.svg)](https://david-dm.org/lazywithclass/winston-cloudwatch#info=peerDependencies)\n==================\n\nSend logs to Amazon Cloudwatch using Winston.\n\n * [Features](#features)\n * [Installing](#installing)\n * [Configuring](#configuring)\n * [Usage](#usage)\n * [Options](#options)\n * [Examples](#examples)\n * [Simulation](#simulation)\n\n### Features\n\n * logging to AWS CloudWatchLogs\n * [logging to multiple streams](#logging-to-multiple-streams)\n * [programmatically flush logs and exit](#programmatically-flush-logs-and-exit)\n * logging with multiple levels\n * creates group / stream if they don't exist\n * waits for an upload to suceed before trying the next\n * truncates messages that are too big\n * batches messages taking care of the AWS limit (you should use more streams if you hit this a lot)\n * support for Winston's uncaught exception handler\n * support for TypeScript, see [TypeScript definition](https://github.com/lazywithclass/winston-cloudwatch/blob/master/typescript/winston-cloudwatch.d.ts)\n * [see options for more](#options)\n\n### Installing\n\n```sh\n$ npm install --save winston winston-cloudwatch\n```\n\n### Configuring\n\nAWS configuration works using `~/.aws/credentials` as written in [AWS JavaScript SDK guide](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Setting_AWS_Credentials).\n\nAs a best practice remember to use one stream per resource, so for example if you have 4 servers you should setup 4 streams\non AWS CloudWatch Logs, this is a general best practice to avoid incurring in token clashes and to avoid limits of the service (see [usage](#usage) for more).\n\n#### Region note\n\nAs specified [in the docs](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Setting_the_Region):\n\n > The AWS SDK for Node.js doesn't select the region by default.\n\nso you should take care of that. See the [examples](#examples) below.\n\nIf either the group or the stream do not exist they will be created for you.\n\n#### AWS UI\n\nFor displaying time in AWS CloudWatch UI you should click on the gear in the top right corner in the page with your logs and enable checkbox \"Creation Time\".\n\n##### TypeScript\n\nRemember to install types for both winston and this library.\n\n### Usage\n\nPlease refer to [AWS CloudWatch Logs documentation](http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html) for possible contraints that might affect you.\nAlso have a look at [AWS CloudWatch Logs limits](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_limits.html).\n\n```js\nvar winston = require('winston'),\n    WinstonCloudWatch = require('../index');\n\nwinston.add(WinstonCloudWatch, {\n  logGroupName: 'testing',\n  logStreamName: 'first'\n});\n\nwinston.error('1');\n```\n\nYou can also specify a function for the `logGroupName` and `logStreamName` options. This is handy if you are using this module in a server, say with [express](https://github.com/bithavoc/express-winston), as it enables you to easily split streams across dates, for example. There is an example of this [here](https://github.com/lazywithclass/winston-cloudwatch/blob/master/examples/function-config.js).\n\n#### Logging to multiple streams\n\nYou could also log to multiple streams with / without different log levels, have a look at [this example](https://github.com/lazywithclass/winston-cloudwatch/blob/master/examples/multiple-loggers.js).\n\nConsider that when using this feature you will have two instances of winston-cloudwatch, each with its own `setInterval` running.\n\n#### Programmatically flush logs and exit\n\nThink AWS Lambda for example, you don't want to leave the process running there for ever waiting for logs to arrive.\n\nYou could have winston-cloudwatch to flush and stop the setInterval loop (thus exiting), have a look\nat [this example](https://github.com/lazywithclass/winston-cloudwatch/blob/master/examples/flush-and-exit.js).\n\n### Options\n\nThis is the list of options you could pass as argument to `winston.add`:\n\n * level - defaults to `info`\n * logGroupName - `string` or `function`\n * logStreamName - `string` or `function`\n * awsAccessKeyId\n * awsSecretKey\n * awsRegion\n * awsOptions - `object`, params as per [docs](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CloudWatchLogs.html#constructor-property), values in `awsOptions` are overridden by any other if specified, run [this example](https://github.com/lazywithclass/winston-cloudwatch/blob/master/examples/simple-with-aws-options.js) to have a look\n * jsonMessage - `boolean`, format the message as JSON\n * messageFormatter - `function`, format the message the way you like. This function will receive a `log` object that has the following properties: `level`, `msg`, and `meta`, which are passed by winston to the `log` function (see [CustomLogger.prototype.log as an example](https://github.com/winstonjs/winston#adding-custom-transports))\n * proxyServer - `String`, use `proxyServer` as proxy in httpOptions\n * uploadRate - `Number`, how often logs have to be sent to AWS. Be careful of not hitting [AWS CloudWatch Logs limits](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_limits.html), the default is 2000ms.\n * errorHandler - `function`, invoked with an error object, if not provided the error is sent to `console.error`\n * retentionInDays - `Number`, defaults to `0`, if set to one of the possible values `1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653` the retention policy on the log group written will be set to the value provided.\n\nAWS keys are usually picked by `aws-sdk` so you don't have to specify them, I provided the option just in case. Remember that `awsRegion` should still be set if you're using IAM roles.\n\n### Examples\n\nPlease refer to [the provided examples](https://github.com/lazywithclass/winston-cloudwatch/blob/master/examples) for more hints.\n\nNote that when running the examples the process will not exit because of the [`setInterval`](https://github.com/lazywithclass/winston-cloudwatch/blob/master/index.js#L73)\n\n### Simulation\n\nYou could simulate how winston-cloudwatch runs by using the files in \n`examples/simulate`:\n\n * `running-process.js` represents a winston-cloudwatch process that sits there,\n sends a couple logs then waits for a signal to send more\n * `log.sh` is a script that you could run to send logs to the above\n \nAt this point you could for example run `log.sh` in a tight loop, like so\n\n```bash\n$ while true; do ./examples/simulate/log.sh $PID; sleep 0.2; done\n```\n\nand see what happens in the library, this might be useful to test if you need\nmore streams for example, all you need to do is change `running-process.js` to\nbetter reflect your needs.\n\nIf you want more detailed information you could do\n\n```bash\n$ WINSTON_CLOUDWATCH_DEBUG=true node examples/simulate/running-process.js\n```\n\nwhich will print lots of debug statements as you might've guessed.\n","readmeFilename":"README.md"}