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

Cloludwatch logging message format changed #149

Open
h2ppy opened this issue Aug 2, 2021 · 1 comment
Open

Cloludwatch logging message format changed #149

h2ppy opened this issue Aug 2, 2021 · 1 comment

Comments

@h2ppy
Copy link

h2ppy commented Aug 2, 2021

After migration from 64bit Amazon Linux 2018.03 v2.11.8 running Java 8 to 64bit Amazon Linux 2 v3.2.4 running Corretto 11 the log file for the elastic beanstalk has been changed from /aws/elasticbeanstalk/{env}/var/log/web-1.log to /aws/elasticbeanstalk/{env}/var/log/web.stdout.log and the change of message format in cloudwatch. Earlier the message logged was the {"key":"string"} now it is being prepended by a time stamp and the ip of the instance for example Jul 31 15:17:13 ip-10-10-20-192 web:{"key":"string"}. How can we get back the original message logged by the application.

@alextanhongpin
Copy link

We are facing the same issue when migrating from from Go 1 running on 64bit Amazon Linux/2.15.1 to Go 1 running on 64bit Amazon Linux 2/3.4.6.

In the old AL, logs are split into web-1.log and web-1.error.log which we streamed to Cloudwatch. In AL2 however, they seem to streamed only to web.stdout.log with the additional prefix web: your log as mentioned by the issue above. Aside from that, the logs are somehow mixed with the nginx access logs when we are expecting only application logs.

We managed to fix it by referring to the solution by puttputt on StackOverflow, together with the configuration files setting here.

Note that when streaming the logs, you have to specify the aws region too (which differs from the AL config) that we had:

files:
  "/etc/awslogs/awscli.conf" :
    mode: "000600"
    owner: root
    group: root
    content: |
      [plugins]
      cwlogs = cwlogs
      [default]
      region = `{"Ref":"AWS::Region"}`

Otherwise, your logs will be streamed to us-east-1 by default, which is something we don't expect ...

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

2 participants