Registry / observability / winston-transport-http-stream

winston-transport-http-stream

JSON →
library0.1.4jsnpmunverified

This package, `winston-transport-http-stream`, provides a custom transport for the Winston logging library, designed to stream log messages to an external HTTP endpoint. It is currently at version 0.1.4, with its last release dating back seven years (April 2019). Due to its age and lack of maintenance, it is highly likely incompatible with modern versions of Winston (v3 and above), which introduced significant breaking changes to the transport API and logger instantiation. Unlike the built-in HTTP transport in Winston, this package has not seen updates to adapt to these changes, nor does it appear to offer unique differentiators beyond basic HTTP streaming of logs. Its primary function is to push log data as JSON to a configured URL, with a notable behavior of silently dropping logs if the HTTP request fails, rather than retrying or emitting an error event.

npm install winston-transport-http-stream
INSTALL
IMPORT
SIG · WINSTON-TRANSPORT-
W
winston-transport-http-stream
observabilityjavascriptv0.1.4
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HttpStreamTransport
const HttpStreamTransport = require('winston-transport-http-stream');
import { HttpStreamTransport } from 'winston-transport-http-stream';
This package was last published in 2019 and primarily supports CommonJS `require()` syntax. It does not provide native ESM exports.
winston
const winston = require('winston');
import winston from 'winston';
While Winston itself supports ESM since v3, this transport's age means it's designed for the CommonJS context where `winston` is imported via `require()`.
winston.createLogger
const logger = winston.createLogger({...});
const logger = new winston.Logger({...});
This transport is likely only compatible with Winston v2, which used `new winston.Logger()`. Winston v3+ uses `winston.createLogger()` and revamped transports. If using modern Winston, this transport will not work without significant adaptations. The quickstart demonstrates Winston v3 `createLogger` syntax but the transport itself is v2-era.

This example demonstrates how to configure Winston with the `HttpStreamTransport` to send logs to a specified HTTP endpoint, including important compatibility caveats regarding Winston versions and basic error handling.

const winston = require('winston'); const HttpStreamTransport = require('winston-transport-http-stream'); // IMPORTANT: This transport is likely only compatible with Winston v2. // The logger setup below uses Winston v3+ API (winston.createLogger). // You may need to adapt your Winston setup or use a compatible Winston version (e.g., v2.x). const logger = winston.createLogger({ level: 'info', format: winston.format.json(), transports: [ new winston.transports.Console(), // Add Console transport for visibility new winston.transports.File({ filename: 'error.log', level: 'error' }), new winston.transports.File({ filename: 'combined.log' }), new HttpStreamTransport({ url: 'https://yourdomain.com/log', // Replace with your actual log endpoint // Additional HTTP options can be passed, see Node.js http.request options. // For HTTPS, ensure proper 'agent' or 'https' module options are configured. // Example with basic auth (Node.js http options): // auth: 'user:password' }) ] }); logger.info('Hello from winston-transport-http-stream!'); logger.warn('This is a warning log.'); logger.error('An error occurred while testing the HTTP stream.'); // Example of how to listen for 'warn' events on the transport itself // if it fails to send logs (behavior may vary based on transport implementation). const httpTransportInstance = logger.transports.find(t => t instanceof HttpStreamTransport); if (httpTransportInstance) { httpTransportInstance.on('warn', (err) => { console.error('HTTP Transport Warning/Error:', err); }); }
Debug
Known issues
breakingThis package was last updated in April 2019 and is highly unlikely to be compatible with Winston v3.x or newer without significant modifications. Winston v3 introduced breaking changes to the transport API, including how transports are defined and how formatting works.
fix
Consider using Winston's built-in `winston.transports.Http` transport (available in Winston v3+) or a more actively maintained community transport for HTTP logging. If you must use this package, you will likely be locked into Winston v2.x.
affects: >=0.1.0
gotchaThe README explicitly states, 'When the request fails the logging request won't be send again.' This means logs can be silently dropped if the HTTP request to the endpoint fails, leading to potential data loss without explicit error handling or retries.
fix
Implement custom error handling for the transport (if its API allows it, like listening to `warn` events as suggested in some Winston contexts) or use a more robust transport that includes retry mechanisms and failure notifications. For critical logs, ensure redundancy with other transports.
affects: >=0.1.0
gotchaThe package is effectively unmaintained, with no updates in seven years. This poses risks related to unpatched bugs, security vulnerabilities in its transitive dependencies, or incompatibilities with newer Node.js versions.
fix
Migrate to an actively maintained logging solution or a more current Winston transport. Regularly review the dependencies of any unmaintained package for known vulnerabilities.
affects: >=0.1.0
gotchaWhile it can send logs to a URL, explicit handling for HTTPS (SSL/TLS options) might be less robust or clear compared to Winston's built-in `Http` transport, which has a dedicated `ssl` option. Misconfiguration could lead to insecure HTTP connections to sensitive endpoints.
fix
When using HTTPS, thoroughly review the Node.js `http.request` options documentation to ensure secure configuration (e.g., `rejectUnauthorized`, `ca`, `cert`, `key`). Consider using `axios` or `node-fetch` within a custom Winston transport for more control over HTTP/S requests.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: winston.Logger is not a constructor
Attempting to instantiate a logger with `new winston.Logger()` in Winston v3+ environments.
fix
Replace `new winston.Logger()` with `winston.createLogger({...})` to align with Winston v3's API. However, this transport itself will likely still be incompatible with Winston v3's transport API.
Logs are not appearing on my HTTP endpoint, but local file logs are working.
The `winston-transport-http-stream` silently drops logs if the HTTP request fails (e.g., network error, DNS resolution failure, endpoint returns non-2xx status, server not reachable).
fix
Verify the `url` option is correct and the target HTTP endpoint is reachable and correctly configured to receive logs. Monitor network activity from your application. Consider adding an 'error' listener to the transport instance if its API supports it to catch underlying network errors, or wrap it in a custom transport that adds retry logic and error reporting.
Error: Transport must be a function or an object with a log method.
This error occurs in newer Winston versions when an incompatible object is passed as a transport, indicating the `winston-transport-http-stream` is not adhering to the current transport interface.
fix
This package is likely not compatible with the `winston-transport` base class used in Winston v3+. You will need to either downgrade Winston to v2.x or rewrite/replace this transport with one compatible with Winston v3+.
Upgrade
Version history
0.1.4latest on npm
Audit
Dependencies
winstonrequiredCore logging library this transport extends; likely only compatible with Winston v2.
Agent activity
27 hits · last 30 days
node
22
OpenAI (training)
1
Resources
winston-transport-http-stream — npm install winston-transport-http-stream · libregistry