Registry / storage / winston-azure-blob

winston-azure-blob

JSON →
library1.5.0jsnpmunverified

A Winston transport for logging to Azure Blob Storage. Current stable version is 1.5.0, with no recent releases (last update 2019). It supports multiple authentication methods (account key, SAS token, connection string), file extension configuration, log rotation, and TypeScript types out of the box. Unlike other Azure log transports, it uses the modern @azure/storage-blob SDK and integrates directly with winston 3. It requires async and winston >=3 as peer dependencies.

npm install winston-azure-blob
INSTALL
IMPORT
SIG · WINSTON-AZURE-BLOB
W
winston-azure-blob
storagejavascriptv1.5.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

winstonAzureBlob
import { winstonAzureBlob } from 'winston-azure-blob'
const winstonAzureBlob = require('winston-azure-blob')
Named export, not default. CommonJS require() works but no default export.
extensions
import { extensions } from 'winston-azure-blob'
Utility object containing log file extensions (e.g., extensions.LOG for '.log').
WinstonAzureBlobOptions
import type { WinstonAzureBlobOptions } from 'winston-azure-blob'
import { WinstonAzureBlobOptions } from 'winston-azure-blob'
TypeScript type, should be imported with `import type` if using isolatedModules or ts-transformer.

Initializes a Winston logger with Azure Blob transport using account name and key authentication.

import * as winston from 'winston'; import { winstonAzureBlob, extensions } from 'winston-azure-blob'; const logger = winston.createLogger({ format: winston.format.combine( winston.format.timestamp(), winston.format.json() ), transports: [ winstonAzureBlob({ account: { name: process.env.AZURE_STORAGE_ACCOUNT ?? '', key: process.env.AZURE_STORAGE_KEY ?? '' }, blobName: 'myapp.log', containerName: 'logs', extension: extensions.LOG, level: 'info' }) ] }); logger.warn('Test log entry');
Debug
Known issues
gotchaThe transport does not automatically create the container. You must create the container manually in Azure before logging.
fix
Create the Azure Blob container using Azure Portal, CLI, or SDK before using the transport.
affects: all
gotchaThe `bufferLogSize` option defaults to -1, meaning no buffering. Each log call immediately writes to Azure Blob Storage which can be slow. Set a positive value to batch logs.
fix
Set bufferLogSize to a positive integer (e.g., 10) to reduce HTTP calls.
affects: all
gotchaThe transport uses `@azure/storage-blob` version 12.x, which has breaking changes from earlier versions. Ensure your project does not use an incompatible version of `@azure/storage-blob` as a direct dependency.
fix
If you need a different version of `@azure/storage-blob`, use a separate instance or check compatibility.
affects: all
gotchaThe `extensions` object exports `LOG` as string '.log'. It is not a direct file extension but just a string; you can pass any string as extension.
fix
Use `extensions.LOG` for '.log', or provide a custom string like '.txt'.
affects: all
Errors
Common errors & fixes
Error: Container does not exist.
The specified container name does not exist in your Azure storage account.
fix
Create the container via Azure portal, CLI, or SDK before running the logger.
TypeError: Cannot read property 'createBlobService' of undefined
Missing or incorrect authentication configuration. The transformer expects account credentials.
fix
Provide a valid account object with name/key, host/sasToken, or connectionString.
Error: getaddrinfo ENOTFOUND <storageaccount>.blob.core.windows.net
The storage account name is invalid or DNS resolution fails.
fix
Check the storage account name; ensure it is correct and accessible.
Upgrade
Version history
1.5.0latest on npm
Audit
Dependencies
asyncoptionalpeer dependency for async operations (e.g., queue processing)
winstonrequiredpeer dependency - the transport is built for winston >=3.0.0
Agent activity
46 hits · last 30 days
node
42
Resources
winston-azure-blob — npm install winston-azure-blob · libregistry