How can I simplify the process of monitoring logs on multiple Amazon EC2 instances in OpsWorks Stacks?

Last updated: 2020-04-03

I want to simplify the process of monitoring logs on multiple Amazon Elastic Compute Cloud (Amazon EC2) instances in AWS OpsWorks Stacks.

Short Description

You can easily monitor logs on multiple Amazon EC2 instances by using Amazon CloudWatch Logs with OpsWorks Stacks. You can enable CloudWatch Logs at the layer level in Linux-based stacks for Chef 11.10 and Chef 12.

Note: If you're using a custom instance profile that isn't created by AWS OpsWorks Stacks, then you must manually attach the AWSOpsWorksCloudWatchLogs policy to your profile. For more information, see Managing IAM Policies.

Resolution

  1. Open the OpsWorks Stacks console.
  2. In the Stack name column, choose the stack that you want to enable with CloudWatch Logs.
  3. In the navigation pane, choose Layers, and then choose CloudWatch Logs.
    Important: To enable CloudWatch Logs, you need an OpsWorks Stacks agent that's compatible with CloudWatch Logs and an IAM policy. You're prompted to upgrade to the latest version of the OpsWorks Stacks agent if your settings don't meet this requirement. If prompted, select the required check boxes, and then choose Upgrade.
  4. For CloudWatch Logs integration, choose On.
  5. To stream command logs, for Stream command logs, choose Yes.
  6. To enable custom logs, for Stream custom logs, enter the full path of the log file.
    Note: For example, to collect NGINX error logs, enter /var/log/nginx/error.log for the path.
  7. Choose Save.
  8. To view the log streams for OpsWorks Stacks, open the Amazon CloudWatch console, and then choose Logs.
    Note: The log streams for OpsWorks Stacks take 1–5 minutes to show up in the CloudWatch console.

Did this article help you?

Anything we could improve?


Need more help?