AWS Elastic Beanstalk Application Console Logs Publish to Cloudwatch

Viewed 20

I have deployed a .net 6 application in AWS Elastic Beanstalk (Windows server). Application has been configured to write application level logs to the console. At the moment, these logs are not published to a CloudWatch by default.

Is there a way that, these console logs can be publised to a Cloudwatch log group? For ex, When using Lambdas, they automatically send console logs to a Cloudwatch stream by default. Something similar would be ideal.

Thanks

1 Answers

Follow this

To stream instance logs to CloudWatch Logs

  • Open the Elastic Beanstalk console, and in the Regions list, select your AWS Region.
  • In the navigation pane, choose Environments, and then choose the name of your environment from the list.
  • In the navigation pane, choose Configuration.
  • In the Software configuration category, choose Edit.
  • Under Instance log streaming to CloudWatch Logs: Enable Log streaming.
  • Set Retention to the number of days to save the logs. Select the Lifecycle setting that determines whether the logs are saved after the environment is terminated. Choose Apply.
  • After you enable log streaming, you can return to the Software configuration category or page and find the Log Groups link. Click this link to see your logs in the CloudWatch console.

Note :- before enabling, you should have proper permissions for cloudwatch agent.

This is an alternate way, https://aws.plainenglish.io/how-to-setup-aws-elasticbeanstalk-to-stream-your-custom-application-logs-to-cloudwatch-d5c877eaa242

Related