# winston-redis

> A fixed-length Redis transport for winston

Latest version **3.1.0** (published 2019-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install winston-redis
pnpm add winston-redis
yarn add winston-redis
bun add winston-redis
```

## 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.1.0 |
| Published | 2019-11-12 |
| First published | 2011-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.11.x |
| Dependencies | 3 |
| Unpacked size | 12.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 42 |
| Author | Charlie Robbins |
| Maintainers | chjj, indexzero, maxjbo |
| Keywords | logging, sysadmin, tools, winston, redis |

## Links

- npm: https://www.npmjs.com/package/winston-redis
- Repository: https://github.com/winstonjs/winston-redis
- Homepage: https://github.com/winstonjs/winston-redis#readme
- Issues: https://github.com/winstonjs/winston-redis/issues
- npm.io page: https://npm.io/package/winston-redis

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^2.6.1
- [lodash](https://npm.io/package/lodash.md) ^4.6.1
- [winston-transport](https://npm.io/package/winston-transport.md) ^4.2.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 3.1.0 (latest) — 2019-11-12
- 3.0.1 (beta) — 2018-11-18
- 3.0.0 — 2018-09-26
- 1.0.0 — 2015-06-12
- 0.3.0 — 2014-12-04
- 0.2.1 — 2012-11-29
- 0.2.0 — 2012-05-31
- 0.1.0 — 2011-08-28

## README

# winston-redis

A capped Redis transport for [winston][0].

## Requirements

- NodeJS 8.11.x
- Winston 3.x

## Usage
``` js
  const winston = require('winston');
  const redisTransport = require('winston-redis');

  const logger = winston.createLogger({
    level: 'info',
    transports: [
      new redisTransport()
    ]
  });

  logger.log({
    level: "info",
    message: "redis is awesome",
    reason: "it's fast" // this will get stored as meta data
  });
```

This transport accepts the options accepted by the [node-redis][1] client:

* __host:__ (Default **localhost**) Remote host of the Redis server
* __port:__ (Default **6379**) Port the Redis server is running on.
* __auth:__ (Default **None**) Password set on the Redis server

In addition to these, the Redis transport also accepts the following options.

* __redis:__ Either the redis client or the options for the redis client
* __length:__ (Default **200**) Number of log messages to store.
* __container:__ (Default **winston**) Name of the Redis container you wish your logs to be in.
* __channel:__ (Default **None**) Name of the Redis channel to stream logs from.
* __meta:__ (Default **{}**) Custom fields to add to each log.
* __flatMeta__: (Default **false**) Store meta data at the top level of the object rather than within a child `meta` object.

*Metadata:* Logged as JSON literal in Redis

## Installation

### Installing npm (node package manager)

``` bash
  $ curl http://npmjs.org/install.sh | sh
```

### Installing winston-redis

``` bash
  $ npm install winston
  $ npm install winston-redis
```

## Run Tests
Winston-redis tests are written in [mocha][2], using [Abstract Winston Transport][3] and designed to be run with npm.

```
  npm test
```

#### Author: [Charlie Robbins](http://github.com/indexzero)

[0]: https://github.com/winstonjs/winston
[1]: https://github.com/mranney/node_redis
[2]: https://mochajs.org
[3]: https://github.com/winstonjs/abstract-winston-transport

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