- Newest
- Most votes
- Most comments
To get your logs showing up in your CloudWatch dashboard, you need to ensure that you've properly configured log output to CloudWatch Logs. For AWS Systems Manager Automation actions, you can enable this by:
- Opening the AWS Systems Manager console
- Navigating to the Automation section
- Selecting the Preferences tab and clicking Edit
- Checking the "Send output to CloudWatch Logs" option
- Optionally enabling encryption for your log data
For your dashboard issue, CloudWatch dashboards can be created and customized to include both metrics and logs. You can use CloudWatch Logs Insights to create dashboard widgets that monitor specific log patterns and display them alongside your metrics.
Regarding templates for your dashboards, you have a couple of options:
- Create a template dashboard that includes all the widgets and configurations you need
- Use infrastructure as code tools (like CloudFormation or Terraform) to define your dashboards
- Programmatically create and update dashboards using the AWS SDK or CLI
Using templates would help with your logging problem if the issue is related to dashboard configuration, but it wouldn't fix underlying logging configuration issues. Make sure your resources are properly configured to send logs to CloudWatch Logs first, then focus on how those logs are displayed in your dashboards.
For automated alarm creation, you can use CloudWatch's built-in alarm recommendations or create custom alarms based on specific metrics, logs, or metric math expressions. These can be templated and deployed automatically as part of your instance provisioning process.
Sources
Logging Automation action output with CloudWatch Logs - AWS Systems Manager
CloudWatch alarms and dashboards - AWS Prescriptive Guidance
Elevating Your AWS Observability: Unlocking the Power of Amazon CloudWatch Alarms | AWS Cloud Operations Blog
Hello Eric,
To use multiple log groups in CloudWatch, here's how you can set it up:
-
First, define multiple log groups in your configuration:
# In your CloudFormation template or similar IaC LogGroups: - LogGroupName: /aws/application1 RetentionInDays: 30 - LogGroupName: /aws/application2 RetentionInDays: 14 -
Configure the CloudWatch agent to send logs to different groups:
{ "agent": { "run_as_user": "root" }, "logs": { "logs_collected": { "files": { "collect_list": [ { "file_path": "/var/log/application1/*.log", "log_group_name": "/aws/application1", "log_stream_name": "{instance_id}-application1" }, { "file_path": "/var/log/application2/*.log", "log_group_name": "/aws/application2", "log_stream_name": "{instance_id}-application2" } ] } } } } -
Store this configuration in Systems Manager Parameter Store:
aws ssm put-parameter \ --name "AmazonCloudWatch-Config" \ --type "String" \ --value file://config.json -
Install and configure the CloudWatch agent on your instances:
# Install the agent yum install -y amazon-cloudwatch-agent # Configure using the SSM parameter /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \ -a fetch-config \ -m ec2 \ -s \ -c ssm:AmazonCloudWatch-Config -
Update your dashboard to include widgets from multiple log groups:
{ "widgets": [ { "type": "log", "properties": { "query": "SOURCE '/aws/application1' | fields @timestamp, @message", "region": "us-east-1", "title": "Application 1 Logs" } }, { "type": "log", "properties": { "query": "SOURCE '/aws/application2' | fields @timestamp, @message", "region": "us-east-1", "title": "Application 2 Logs" } } ] }
Remember to:
- Ensure proper IAM permissions for accessing multiple log groups
- Update retention policies as needed
- Consider costs when collecting logs from multiple sources
- Use log stream names that make sense for your use case
I hope this is helpful. If yes, please upvote/accept my answer. Thank you.
Relevant content
- asked 2 years ago

Right now it's set to default but I want it to use multiple log groups. How can I do that?