{"id":46807,"library":"winston-redis-stream","title":"winston-redis-stream","description":"A fixed-length Redis transport for winston using Redis Streams (Redis 5.0+). Current version 0.0.3, last updated on npm. This is a fork of the original winston-redis, rewritten to use ioredis and Redis Streams for capped log storage. Unlike the original, it does not support Redis Pub/Sub for logging. The query method filters by time range and supports field selection. Requires Node >=8.11, winston ^3.0.0, and Redis server >=5.0.0. Lightweight, no external dependencies beyond winston and ioredis.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","logging","sysadmin","tools","winston","redis"],"install":[{"cmd":"npm install winston-redis-stream","lang":"bash","label":"npm"},{"cmd":"yarn add winston-redis-stream","lang":"bash","label":"yarn"},{"cmd":"pnpm add winston-redis-stream","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency — required for creating logger and using transport","package":"winston","optional":false}],"imports":[{"note":"The package uses CommonJS, but default import works in ESM environments via interop. Avoid using .default with require.","wrong":"const RedisTransport = require('winston-redis-stream').default","symbol":"default import","correct":"import RedisTransport from 'winston-redis-stream'"},{"note":"No named export; the transport is the default export.","wrong":"const RedisTransport = require('winston-redis-stream').RedisTransport","symbol":"require (CommonJS)","correct":"const RedisTransport = require('winston-redis-stream')"},{"note":"Must instantiate the transport with 'new'. Passing the class directly will fail.","wrong":"winston.add(RedisTransport)","symbol":"winston.add","correct":"const winston = require('winston'); const RedisTransport = require('winston-redis-stream'); winston.add(new RedisTransport({...}))"}],"quickstart":{"code":"const winston = require('winston');\nconst RedisTransport = require('winston-redis-stream');\n\nconst logger = winston.createLogger({\n  level: 'info',\n  transports: [\n    new RedisTransport({\n      host: process.env.REDIS_HOST || 'localhost',\n      port: parseInt(process.env.REDIS_PORT || '6379'),\n      auth: process.env.REDIS_PASSWORD || '',\n      length: 200,\n      container: 'winston',\n      flatMeta: false\n    })\n  ]\n});\n\nlogger.info('Hello Redis Streams!', { extra: 'metadata' });\n\nsetTimeout(() => {\n  logger.query({\n    from: new Date() - 3600000,\n    until: new Date(),\n    limit: 10,\n    order: 'desc',\n    fields: ['level', 'message', 'timestamp', 'extra']\n  }, (err, results) => {\n    if (err) throw err;\n    results.redis.forEach(log => console.log(`${log.timestamp} ${log.level}: ${log.message}`));\n  });\n}, 1000);","lang":"javascript","description":"Shows how to create a winston logger with the Redis transport, log a message, and query recent logs from Redis."},"warnings":[{"fix":"Upgrade Redis server to version 5.0.0 or later.","message":"Requires Redis server >=5.0.0 for Redis Streams. Earlier versions are not supported.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Adjust any custom Redis client configuration to be compatible with ioredis options.","message":"Uses ioredis instead of node-redis. Existing code expecting the 'node-redis' client API will not work.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use the original winston-redis if Pub/Sub logging is required.","message":"No support for Redis Pub/Sub (stream method not tested). Only Redis Streams (XADD, XRANGE) are used.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Access results.redis (array of logs) when using logger.query()","message":"Query method uses the 'redis' property in results, not a transport name.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add flatMeta: true to transport options if you want meta fields at top level.","message":"The 'meta' option stores metadata as a nested object by default. Set flatMeta: true to flatten.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.3':20 '3.0.0':72 '5.0':17 '5.0.0':76 '8.11':70 'beyond':81 'cap':43 'current':18 'depend':80 'extern':79 'field':66 'filter':60 'fix':7 'fixed-length':6 'fork':28 'ioredi':38,84 'javascript':85 'last':21 'length':8 'lightweight':77 'log':44,56,86 'method':59 'node':69 'npm':24 'origin':31,48 'pub/sub':54 'queri':58 'rang':63 'redi':3,9,14,16,34,40,53,74,90 'requir':68 'rewritten':35 'select':67 'server':75 'storag':45 'stream':4,15,41 'support':52,65 'sysadmin':87 'time':62 'tool':88 'transport':10 'unlik':46 'updat':22 'use':13,37 'version':19 'winston':2,12,33,71,82,89 'winston-redi':32 'winston-redis-stream':1","created_at":"2026-06-07T13:01:43.602503+00:00","updated_at":"2026-06-07T13:01:43.602503+00:00","problems":[{"fix":"Start Redis server, or specify correct host/port in transport options.","cause":"Redis server is not running or not accessible at default host/port.","error":"Error: Redis connection refused - connect ECONNREFUSED 127.0.0.1:6379"},{"fix":"Use const RedisTransport = require('winston-redis-stream'); without .default.","cause":"Importing the transport incorrectly, e.g., using require('winston-redis-stream').default in CJS.","error":"TypeError: RedisTransport is not a constructor"},{"fix":"Upgrade Redis server to version 5.0 or higher.","cause":"Using an older Redis version (<5.0) that does not support Streams.","error":"ERR wrong number of arguments for 'xadd' command"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://gitlab.com/nottledim/winston-redis-stream.git#readme","github":null,"docs":null,"changelog":null,"pypi":null,"npm":"winston-redis-stream","openapi_spec":null,"status_page":null,"smithery":null,"categories":["logging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}