A SysOps Administrator is configuring a monitoring solution for a fleet of web servers. The web servers write access logs to an Amazon CloudWatch Logs group in the Apache Common Log Format (CLF). The administrator needs to monitor for server-side errors and identify instances where response sizes exceed (). Specifically, if there are more than occurrences of HTTP status codes in the range combined with a response size greater than within any window, the administrator must receive an email notification. Additionally, to manage costs, the log group's retention period must be automatically adjusted to days if a peak event occurs, as it is currently set to never expire. Which TWO actions should the SysOps Administrator take to meet these requirements?
- Create a metric filter on the log group using the pattern `[ip, id, user, timestamp, request, status_code = 5*, size > 10000]`. Create a CloudWatch alarm based on this metric with a threshold of within a period, and configure an Amazon SNS action to send an email notification.Answer
- Create an Amazon EventBridge rule that triggers when the CloudWatch alarm transitions to the `ALARM` state, and configure the rule to target an AWS Systems Manager Automation document to update the log group's retention period to days.Answer
- CAdd a remediation action directly to the CloudWatch alarm configuration to modify the log group's retention period to days using the CloudWatch Logs service action.
- DEnable detailed monitoring on the CloudWatch Logs group to ensure log events are processed at intervals, then configure the CloudWatch alarm with a period to evaluate the threshold.
- EConfigure an AWS Config rule to monitor the CloudWatch alarm status, and define an AWS Config remediation target that directly invokes an AWS Lambda function to change the log group retention when the alarm status becomes non-compliant.