Skip to content

CloudWatch Logs not getting created #224

Open
@riyajn17

Description

@riyajn17

Hi, I am not able to see logs in my cloudwatch log group when I do any activity in application, It's just I got some logs when I deployed the changes for first time.

This is my logger file -
import { createLogger, format } from 'winston';
import WinstonCloudWatch from 'winston-cloudwatch';
import uuid from 'uuid';
import moment from 'moment-timezone';

function messageFormatter({ timestamp, level, message }): string {
const logObject: LogObject = {
level: level.toUpperCase(),
timestamp,
message
};

return JSON.stringify(logObject); // Convert the object to a JSON string

}

export const logger = createLogger({
exitOnError: false,
format: format.combine(format.timestamp(), format.printf(messageFormatter)),
transports: [
new WinstonCloudWatch({
logGroupName: 'AmazonDefine-Frontend-Logs',
logStreamName: define-frontend-logs-${moment.utc().format('YYYY-MM-DD')}-${uuid.v4()},
awsRegion: 'us-west-2',
messageFormatter
})
]
});

interface LogObject {
level: string;
timestamp: string;
message: string;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions