Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudWatch Logs not getting created #224

Open
riyajn17 opened this issue Feb 15, 2024 · 1 comment
Open

CloudWatch Logs not getting created #224

riyajn17 opened this issue Feb 15, 2024 · 1 comment

Comments

@riyajn17
Copy link

riyajn17 commented Feb 15, 2024

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;
}

@riyajn17
Copy link
Author

@lazywithclass , can you please take a look. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant