1

I am new to AWS elastic beanstalk and trying to stream my application log file to Cloudwatch logs using configuration file (.ebextensions.)

I'm reusing the same configuration code provided here

I have placed the mycustom.conf in .ebextensions folder and placed this folder in ROOT of my .war file. I validated the YAML code using online validator (http://www.yamllint.com/) and no issues were reported. I haven't seen any error in either eb-activity-log or eb-publish-logs. I also tried doing ssh to my instance and I couldn't find the file mycustom.conf created in /etc/awslogs/config/. Is there anything that am missing ?

Adding mycustom.conf below: Please help!!

files:
  "/etc/awslogs/config/mycustom.conf" :
    mode: "000600"
    owner: root
    group: root
    content: |
      [/var/log/tomcat8/myapp.log]
      log_group_name = `{"Fn::Join":["/", ["/aws/elasticbeanstalk", { "Fn::Select" : [ "1", { "Fn::Split" : [ "-", { "Ref":"AWSEBEnvironmentName" } ] } ] }, "var/log/tomcat8/myapp.log"]]}`
      log_stream_name = `{"Fn::Join":["--", [{ "Ref":"AWSEBEnvironmentName" }, "{instance_id}"]]}`
      file = /var/log/tomcat8/myapp.log*
Kunal Jain
  • 11
  • 2
  • Did you allow your EC2 instances to access Cloudwatch? You will need to add the CloudWatchAgentServerPolicy and possibly AmazonEC2RoleforSSM policies to your aws-elasticbeanstalk-ec2-role. [Here is some documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/installing-cloudwatch-agent-ssm.html) (though it looks like the SSM policy may be called AmazonSSMManagedInstanceCore now) – littleforest Jun 16 '19 at 18:47

0 Answers0