You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am facing the issue logs are not printing in the given log group name. logs are printing in the lambda function name group.
please help me to resolve the issue.
any suggestions.
Thanks for response.
Yes i tried ,logs are logging in lambda function group name instead of given group name.i gave correct format of the code, after submit of my code it was showing in different format.
Hi ,
I am facing the issue logs are not printing in the given log group name. logs are printing in the lambda function name group.
please help me to resolve the issue.
any suggestions.
const winston = require('winston'),
WinstonCloudWatch = require('winston-cloudwatch');
const logger = new winston.createLogger({
format: winston.format.json(),
transports: [
new (winston.transports.Console)({
timestamp: true,
colorize: true,
})
]
});
if (process.env.NODE_ENV === 'production') {
const cloudwatchConfig = {
logGroupName: "test",
logStreamName: "test-dev",
awsAccessKeyId: "",
awsSecretKey: "",,
awsRegion: "********",
messageFormatter: ({ level, message, additionalInfo }) =>
[${level}] : ${message} \nAdditional Info: ${JSON.stringify(additionalInfo)}}
}
logger.add(new WinstonCloudWatch(cloudwatchConfig))
}
exports.handler = async (event) => {
// TODO implement
logger.info("index Lambda invoked");
logger.error('index Test log');
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda! index2'),
};
return response;
};
Thanks.
The text was updated successfully, but these errors were encountered: