Logs not working on Elastic Beanstalk Tomcat environment

眉间皱痕 提交于 2020-12-30 04:06:37

问题


We've been using Elastic Beanstalk to run our Java (8) applications on Tomcat in our company without any issues. Now we have decided to move on to Java 11. We set up our environments with CloudFormation as we did before for the Java 8 applications but now we are using this solution stack: '64bit Amazon Linux 2 v4.1.1 running Tomcat 8.5 Corretto 11' (also tried v4.1.2). Everything works fine but it looks like the request logs feature isn't working anymore in elastic beanstalk (Last 100 lines and full logs). I also added a keypair to the application server to check the logs on the ec2 server at /var/log/tomcat/ but we can't find the catalina.out file (only catalina files with a date like: catalina.2020-10-14.log). Those files contains only logs of a library we used but not the logs we send to the Standard system output. Another company we sometimes work with experiences the same issue on this solution stack.

Has anyone experienced the same issue on this solution stack and found a fix?

This is our CloudFormation configuration (YAML):

Application:
Type: AWS::ElasticBeanstalk::Application
Properties:
Description: Application backend
ApplicationVersion:
Type: AWS::ElasticBeanstalk::ApplicationVersion
Properties:
ApplicationName:
Ref: Application
Description: !Ref AppVersion
SourceBundle:
S3Bucket: !Ref BeanstalkSourceS3
S3Key: !Ref BuildFileName
AppEC2ServiceRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service:
- elasticbeanstalk.amazonaws.com
Action:
- sts:AssumeRole
ManagedPolicyArns:
- "arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth"
- "arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkService"
AppEnvironment:
Type: AWS::ElasticBeanstalk::Environment
Properties:
ApplicationName:
Ref: Application
OptionSettings:
- Namespace: aws:autoscaling:launchconfiguration
OptionName: InstanceType
Value: !Ref EC2InstanceSize
- Namespace: aws:elasticbeanstalk:environment
OptionName: EnvironmentType
Value: SingleInstance
- Namespace: aws:autoscaling:launchconfiguration
OptionName: IamInstanceProfile
Value: !Ref AppInstanceProfile
- Namespace: aws:autoscaling:launchconfiguration
OptionName: EC2KeyName
Value: CompanyTestKey
- Namespace: aws:ec2:vpc
OptionName: VPCId
Value: !Ref Vpc
- Namespace: aws:ec2:vpc
OptionName: Subnets
Value: !Join [",",https://forums.aws.amazon.com/
- Namespace: aws:ec2:vpc
OptionName: AssociatePublicIpAddress
Value: true
- Namespace: aws:elasticbeanstalk:environment
OptionName: ServiceRole
Value: !Ref AppEC2ServiceRole
- Namespace: aws:elasticbeanstalk:cloudwatch:logs
OptionName: StreamLogs
Value: true
- Namespace: aws:elasticbeanstalk:cloudwatch:logs
OptionName: RetentionInDays
Value: 14
SolutionStackName: 64bit Amazon Linux 2 v4.1.1 running Tomcat 8.5 Corretto 11
VersionLabel:
Ref: ApplicationVersion
Tags:
- Key: group
Value: !Ref ResourceGroupTagValue

来源:https://stackoverflow.com/questions/64481718/logs-not-working-on-elastic-beanstalk-tomcat-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!