winston-daily-rotate-file
A Winston transport that rotates log files daily, by size, and with automatic compression
Repository Health
Technical Analysis
winston-daily-rotate-file is a transport plugin for the Winston logging library that writes logs to a file that automatically rotates on a daily basis (or a configurable pattern), with optional size-based rotation, gzip compression of rotated files, and automatic pruning of old logs by age or total count. It’s a common addition to any Node.js service using Winston that needs disk-based logs without unbounded file growth or manual log-rotation tooling.
The package integrates directly into Winston’s transport interface, so it’s added alongside console or other transports in a standard Winston logger configuration rather than requiring a separate logging pipeline.
What You Get
- A drop-in Winston transport following the standard
winston.transportsinterface - Daily rotation by default, with configurable date patterns and size-based rotation thresholds
- Optional gzip compression of rotated log files
- Automatic pruning of old logs by max file count or max age
- Events (
rotate,new,archive,logRemoved) for hooking into the rotation lifecycle
Common Use Cases
- Node.js services writing persistent file-based logs that need automatic daily rotation instead of one ever-growing log file
- Compliance/audit logging setups that need retained, dated, and eventually pruned log archives
- Reducing disk usage on long-running servers by combining size-based rotation with gzip compression
- Hooking into rotation events to trigger log shipping/upload to external storage right after a file rotates
Under The Hood
Architecture: The core (daily-rotate-file.js, ~370 lines) extends Winston’s TransportStream base class and computes the current file name from a moment-style date pattern on each write, opening a new file stream when the pattern’s rendered value changes (i.e. when the day rolls over) or when a size threshold is exceeded. Rotation, archiving (gzip), and pruning are handled as side effects triggered from within the same write path rather than a separate background scheduler process.
Tech Stack: Plain Node.js/CommonJS, depending directly on winston-transport for the base class contract and using Node’s built-in zlib/fs for compression and file I/O rather than external rotation binaries.
Code Quality: The test/transport-tests.js suite covers rotation-by-date, rotation-by-size, and pruning behavior, plus a transport.worker.js used to validate behavior when logging from multiple processes. TypeScript definitions (index.d.ts) are bundled for consumer type safety, though the project has had no commits since March 2024.
API Design: Configuration is a flat options object passed straight into Winston’s standard transport-array pattern (new transports.DailyRotateFile({...})), so anyone already familiar with Winston can add rotation with a single new transport entry — a low learning curve given prior Winston familiarity.
Used by 10 apps in this directory
APITable
Low Code Platforms · Databases
API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.
Cherry Studio
AI Assistants
All-in-one AI desktop client with 300+ assistants and multi-model support
Flowise
Developer Tools · Automation · No Code Platforms
Drag-and-drop visual builder for AI agents, RAG pipelines, and multi-agent systems—deploy anywhere in minutes.
Huly Platform
Project Management · Team Chat · Collaboration
Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.
LibreChat
Developer Tools · AI Assistants
Unite every major AI model in one self-hosted chat platform with agents, code execution, MCP tools, and enterprise authentication.
Medplum
Developer Tools · Databases · Authentication
An open-source, FHIR-native healthcare platform that gives developers a compliant backend, authentication, a React component library, and serverless bots to build clinical applications in weeks instead of years.
NocoBase
No Code Platforms · Low Code Platforms
Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.
Pangolin
Networking
An open-source, identity-based zero-trust remote access platform built on WireGuard — a self-hostable alternative to Cloudflare Tunnel and Twingate with SSO, OIDC, and tunneled reverse proxying.
Parse Server
Developer Tools · Databases
Self-hosted Backend-as-a-Service for Node.js with REST, GraphQL, real-time Live Query, cloud code, and pluggable adapters for any infrastructure.