Skip to content

Logfile problems with keep alive logs sent to /var/log/cfn-wire.log

0

Hi, my Elastic Beanstalk environment's server's disk keeps getting full. In looking at the problem I see that one possibility is that cloud formation keeps logging keep alives to the /var/log/cfn-wire.log file. It creates entries like the following over and over:

2024-10-01 12:01:07,471 [DEBUG] Response: 200 https://sqs.ca-central-1.amazonaws.com/<clipped>/?Action=ReceiveMessage&Version=2012-11-05&MaxNumberOfMessages=1&AttributeName.1=All&WaitTimeSeconds=20 [headers: {'x-amzn-RequestId': '6d68efce-c6a2-5a67-9998-b0bb200dce75', 'Date': 'Tue, 01 Oct 2024 12:01:07 GMT', 'Content-Type': 'text/xml', 'Content-Length': '240', 'connection': 'keep-alive'}]

Now, I did not use cloud formation explicitly... but something is being invoked by my Elastic Beanstalk environment. How do I stop this log from creating huge log files? I either need to disable this log (and perhaps other events from cfn or other systems) or have some way for the logs to get rotated or streamed to cloudwatch, then deleted on the server itself.

Can anyone help me configure this so my disk doesn't get eaten up by this file? Are there recommended examples of how I should configure the instance to properly handle system logs (ie. cfn logs, eb logs, etc.)

  • I still need a solution - even trying to fix it with logrotate, it seems like its already rotating. But I can't find the configuration file defining the rotation settings for this file. And I can't find anywhere how to stop or slow down the keep-alive messages, or set the logging level to something less verbose.

1 Answer
-1

To address the issue of your Elastic Beanstalk environment's server disk getting full due to the cfn-wire.log file, there are several approaches you can take:

  1. Log Rotation: You can configure log rotation for the cfn-wire.log file. This will automatically compress and archive old log files, preventing a single file from growing too large.

  2. Stream Logs to CloudWatch: Elastic Beanstalk provides the ability to stream instance logs to Amazon CloudWatch Logs. This can help manage log storage on the instance itself.

To enable log streaming to CloudWatch Logs:

  1. Open the Elastic Beanstalk console and select your environment.
  2. In the navigation pane, choose "Configuration".
  3. Under "Updates, monitoring, and logging" configuration category, select "Edit".
  4. In the "Instance log streaming to CloudWatch Logs" section, set "Log streaming" to "Enabled".
  5. Configure the retention period and lifecycle settings as needed.
  6. Apply the changes.

This will stream various logs, including system logs, to CloudWatch Logs. While cfn-wire.log isn't explicitly mentioned in the default log streams, you may be able to add it to the list of logs being streamed.

  1. Custom Log Configuration: You can create a custom configuration file in the .ebextensions directory of your application source to manage specific log files like cfn-wire.log. This could include setting up log rotation or redirecting the log to CloudWatch Logs.

  2. Increase Storage: If the logs are necessary and you can't reduce their size, consider increasing the storage capacity of your Elastic Beanstalk instances.

  3. Review CloudFormation Usage: Although you mentioned not explicitly using CloudFormation, Elastic Beanstalk often uses CloudFormation behind the scenes to provision resources. You may want to review your Elastic Beanstalk configuration to see if there are any unnecessary resources or processes that could be generating these logs.

Remember to test any changes in a non-production environment first to ensure they don't negatively impact your application's performance or functionality.
Sources
Viewing your Elastic Beanstalk environment logs - AWS Elastic Beanstalk
Using Elastic Beanstalk with Amazon CloudWatch Logs - AWS Elastic Beanstalk
eb logs - AWS Elastic Beanstalk

answered 2 years ago

  • Thanks for this information. I have CloudWatch logging turned on already. I understand I can configure custom log configurations using .ebextensions, but rather than incurring cost/complexity for this particular log file I'd like to disable it at source in cloudformation. If you have any recommendations for how to do that I'd appreciate it.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.