logfx-cloudwatch
v1.0.0
Published
AWS CloudWatch Logs integration for logfx
Maintainers
Readme
logfx-cloudwatch
AWS CloudWatch Logs transport for logfx.
Install
npm install logfx logfx-cloudwatchOptions
| Option | Type | Required | Description |
|--------|------|----------|-------------|
| logGroupName | string | yes | CloudWatch log group |
| logStreamName | string | yes | Log stream name |
| region | string | no | AWS region (default: AWS_REGION or us-east-1) |
| credentials | object | no | { accessKeyId, secretAccessKey } |
| batchSize | number | no | Batch size (default: 100) |
| flushInterval | number | no | Flush interval ms (default: 5000) |
Usage
import { createLogger } from 'logfx'
import { cloudwatchTransport } from 'logfx-cloudwatch'
const log = createLogger({
transports: [
cloudwatchTransport({
logGroupName: '/myapp/logs',
logStreamName: 'api',
region: 'us-east-1'
})
]
})
log.info('Request received', { userId: 42 })Uses default AWS credential chain (env vars, IAM role). Or pass credentials explicitly.
