SOA-C02 Question 24
Select 4You are tasked with monitoring specific error messages in your application logs stored in Amazon CloudWatch Logs. To achieve this, you need to create a metric filter that will track occurrences of the error message 'ERROR 500' and trigger an alarm if the count exceeds a certain threshold. Which of the following steps would you need to perform to correctly set up this solution?
- A
Define the filter pattern to match the 'ERROR 500' message in the log data.
- B
Attach the metric filter directly to the CloudWatch Alarm.
- C
Specify a metric namespace, metric name, and value to publish matching log events to a custom CloudWatch metric.
- D
Create a CloudWatch Alarm to monitor the custom metric created by the metric filter.
- E
Apply the metric filter to the CloudWatch Log Group containing your application logs.
Show answer and explanation
Correct answers: A, C, D, E
Explanation
To monitor specific log events such as 'ERROR 500', you must first create a metric filter with a filter pattern that matches the log events. The metric filter must specify a namespace, metric name, and value to publish the matched events to a custom CloudWatch metric. The metric filter is then applied to the relevant CloudWatch Log Group. Finally, a CloudWatch Alarm needs to be created to monitor the custom metric and trigger alerts when the metric value exceeds the defined threshold. Metric filters are not directly attached to alarms but instead act as a bridge between logs and metrics.
- A. Correct.
Correct. A filter pattern is required to define what log data the metric filter should match (e.g., 'ERROR 500').
- B. Incorrect.
Incorrect. Metric filters are not directly attached to CloudWatch Alarms. Instead, they publish data to custom metrics, which the alarm can then monitor.
- C. Correct.
Correct. When creating a metric filter, you must specify a metric namespace, metric name, and a value to publish to the custom CloudWatch metric.
- D. Correct.
Correct. To trigger an alarm based on the matched log events, you need to create a CloudWatch Alarm that monitors the custom metric created by the metric filter.
- E. Correct.
Correct. The metric filter must be applied to the specific Log Group that contains the application logs you want to monitor.