1

I'm reading the documentation but I'm not understanding simple Java application log access via CloudWatch from AWS Elastic Beanstalk.

I have a simple Java Spring Boot Application deployed on Elastic Beanstalk as a JAR file using the Java Corretto 11 platform with HTTPS. It has successfully created an EC2 instance and a load balancer. I can access the web site via HTTPS. I can see simple access log statistics in the Elastic Beanstalk environment monitoring section.

But where do the Java logs go, and how can I look into them in CloudWatch?

The Using Elastic Beanstalk with Amazon CloudWatch Logs documentation seems to be about the legacy CloudWatch Logs agent, not the new unified CloudWatch agent. Whatever the case, that page says:

Elastic Beanstalk configures log groups in CloudWatch Logs for the various log files that it streams.

But in CloudWatch Logs I have no log groups. So something is wrong already.

My Spring Boot JAR application is running on Elastic Beanstalk. What are my next steps to view the Spring Boot logs in CloudWatch Logs?

1

The secret is that for the AWS Elastic Beanstalk environment, under Configuration there is a section "Instance log streaming to CloudWatch Logs". The setting Log streaming must be enabled.

This is alluded to in the Using Elastic Beanstalk with Amazon CloudWatch Logs documentation (emphasis added):

When you enable instance log streaming to CloudWatch Logs, Elastic Beanstalk sends log files from your environment's instances to CloudWatch Logs.

2
  • this still doesnt send for example tomcat logs from your environment to cloudwatch.It only sends the standard logs such as any nginx access logs etc. – whokares Apr 29 at 18:28
  • @whokares Refer to the Custom log file streaming section of that documentation. You will need to add an .ebextensions config file to your deployment specifying the location of your app logs – Cavyn VonDeylen Jun 1 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.