Open
Description
I am looking for a way to send my Winston generated logs to CloudWatch and found this module / plugin / project and had high hopes but after about two hours, I am not able to get it to work with Lambda. The code does work locally and the log stream does get created and logged to however when deploying via Lambda, the log stream is not created.
Here is the current code I am using:
const cloudwatchLogger = logger.add(new WinstonCloudWatch({
awsOptions: {
credentials: {
accessKeyId: process.env.AWS_ACCESSKEYID,
secretAccessKey: process.env.AWS_SECRETACCESSKEYID
},
region: process.env.CLOUDWATCH_REGION
},
name: 'cloudwatchLogger',
logGroupName: process.env.CLOUDWATCH_GROUP_NAME,
logStreamName: `${process.env.CLOUDWATCH_GROUP_NAME}-${process.env.NODE_ENV}`,
awsRegion: process.env.CLOUDWATCH_REGION
}))
cloudwatchLogger.transports.find((t) => t.name === 'cloudwatchLogger').kthxbye(() => {
console.log('---===...transport buffer flushed...===---')
})
It would also be great to be able to define the log formatter using the built-in Winston combine
method. For example, this is what I use in my other transports:
format: winston.format.combine(
winston.format.errors({ stack: false }),
winston.format.timestamp({
format: 'MMM-DD-YYYY HH:mm:ss'
}),
winston.format.metadata(),
winston.format.prettyPrint(),
winston.format.json()
)
Lastly, it does not appear that this project is maintained anymore. There are multiple open issues, some with fixes, but no response from the project maintainer. Is this project still supported?
Metadata
Metadata
Assignees
Labels
No labels