# winston-aws-cloudwatch

> A Winston transport for Amazon CloudWatch.

Latest version **3.0.0** (published 2022-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install winston-aws-cloudwatch
pnpm add winston-aws-cloudwatch
yarn add winston-aws-cloudwatch
bun add winston-aws-cloudwatch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2022-06-29 |
| First published | 2015-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 5 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tim De Pauw |
| Maintainers | timdp |
| Keywords | amazon, aws, cloudwatch, winston, log, logs, logging, cloud, saas |

## Links

- npm: https://www.npmjs.com/package/winston-aws-cloudwatch
- Repository: https://github.com/timdp/winston-aws-cloudwatch
- Issues: https://github.com/timdp/winston-aws-cloudwatch/issues
- npm.io page: https://npm.io/package/winston-aws-cloudwatch

## Dependencies (5)

- [debug](https://npm.io/package/debug.md) ^3.1.0
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.293.0
- [bottleneck](https://npm.io/package/bottleneck.md) ^1.16.0
- [lodash.isempty](https://npm.io/package/lodash.isempty.md) ^4.2.1
- [winston-transport](https://npm.io/package/winston-transport.md) ^4.2.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2018-08-15
- 2.0.0 — 2017-12-17
- 1.6.0 — 2017-09-16
- 1.5.0 — 2017-05-26
- 1.4.0 — 2016-09-21
- 1.3.0 — 2016-07-10
- 1.2.1 — 2016-07-06
- 1.2.0 — 2016-06-12
- 1.1.0 — 2016-02-13
- 1.0.0 — 2016-02-11
- 0.6.0 — 2016-02-11
- 0.5.0 — 2015-12-31
- 0.4.2 — 2015-09-02
- 0.4.1 — 2015-08-16
- 0.4.0 — 2015-08-16
- … 6 more at https://npm.io/package/winston-aws-cloudwatch/versions

## README

# winston-aws-cloudwatch

[![npm](https://img.shields.io/npm/v/winston-aws-cloudwatch.svg)](https://www.npmjs.com/package/winston-aws-cloudwatch) [![Dependencies](https://img.shields.io/david/timdp/winston-aws-cloudwatch.svg)](https://david-dm.org/timdp/winston-aws-cloudwatch) [![Build Status](https://img.shields.io/circleci/project/github/timdp/winston-aws-cloudwatch/master.svg?label=build)](https://circleci.com/gh/timdp/winston-aws-cloudwatch) [![Coverage Status](https://img.shields.io/coveralls/timdp/winston-aws-cloudwatch/master.svg)](https://coveralls.io/r/timdp/winston-aws-cloudwatch) [![JavaScript Standard Style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://standardjs.com/)

A [Winston](https://www.npmjs.com/package/winston) transport for
[Amazon CloudWatch](https://aws.amazon.com/cloudwatch/).

## Usage

```js
const winston = require('winston')
const CloudWatchTransport = require('winston-aws-cloudwatch')

const logger = winston.createLogger({
  transports: [
    new CloudWatchTransport({
      logGroupName: '...', // REQUIRED
      logStreamName: '...', // REQUIRED
      createLogGroup: true,
      createLogStream: true,
      submissionInterval: 2000,
      submissionRetryCount: 1,
      batchSize: 20,
      awsConfig: {
        accessKeyId: '...',
        secretAccessKey: '...',
        region: '...'
      },
      formatLog: item =>
        `${item.level}: ${item.message} ${JSON.stringify(item.meta)}`
    })
  ]
})
```

## Error Handling

If, for any reason, logging to CloudWatch should fail, then the transport will
emit an `error` event. It is recommended that you
[subscribe to this event](https://www.npmjs.com/package/winston#awaiting-logs-to-be-written-in-winston)
to avoid crashes.

## But Why?

As you may have noticed, there is also
[winston-cloudwatch](https://www.npmjs.com/package/winston-cloudwatch), which
predates this module. After making some contributions to that one, I felt like
writing my own version. Feel free to use whichever you like best.

## Author

[Tim De Pauw](https://tmdpw.eu/)

## License

MIT

---
_Source: https://npm.io/package/winston-aws-cloudwatch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
