Soru

Zorluk: ZorCloudWatch Logs and Metric Filters

An organization deploys an application across four microservices hosted on Amazon ECS. Each microservice writes logs to its own dedicated CloudWatch Logs log group: `/aws/ecs/frontend`, `/aws/ecs/auth-service`, `/aws/ecs/catalog`, and `/aws/ecs/payment`. To maintain service-level agreements, a SysOps administrator must establish a mechanism to alert the team when the aggregate number of `HTTP 504` gateway timeout errors across all four microservices exceeds 4545 in any 1010-minute period.

Which configuration should the administrator implement to meet this requirement?

  1. A
    Enable detailed monitoring on the ECS cluster. Create a single metric filter on a new log group named `/aws/ecs/aggregated` to capture all cluster-wide events, and configure a CloudWatch alarm to trigger if the metric exceeds 4545 within a 1010-minute period.
  2. B
    Create an Amazon EventBridge rule that matches `PutLogEvents` API calls containing `HTTP 504` error codes. Target an AWS Systems Manager Automation runbook that aggregates the event count in a custom Amazon DynamoDB table, and set up a CloudWatch alarm on the table's write capacity metrics.
  3. Define an identical metric filter on each of the four log groups using the same filter pattern, custom namespace, and metric name. Configure a single CloudWatch alarm on the aggregated metric using the Sum statistic over a 1010-minute period with a threshold of 4545.Cevap
  4. D
    Set the CloudWatch Logs retention period to 10 days for all log groups. Configure a metric filter at the log group prefix level of `/aws/ecs/` to automatically aggregate the error count, and define an alarm threshold of 4545 for the retention duration.

Cevap

Define an identical metric filter on each of the four log groups using the same filter pattern, custom namespace, and metric name. Configure a single CloudWatch alarm on the aggregated metric using the Sum statistic over a 1010-minute period with a threshold of 4545.
To aggregate metrics across multiple log groups in CloudWatch Logs, you must create a metric filter on each individual log group. By directing each filter's metric transformation to publish to the same custom namespace and metric name, CloudWatch automatically aggregates the metrics. Setting a CloudWatch alarm on the aggregated metric using the Sum statistic evaluates the cumulative value from all log groups over the specified duration.

Adım Adım Çözüm

1
Configure a metric filter on each of the four individual log groups: `/aws/ecs/frontend`, `/aws/ecs/auth-service`, `/aws/ecs/catalog`, and `/aws/ecs/payment`.
Four separate metric filters are created, each scanning its respective log group for the `HTTP 504` pattern.
Metric filters in CloudWatch Logs are scoped to a single log group and cannot span multiple groups directly via wildcards or prefixes.
2
Map all four metric filters to output to the exact same custom metric namespace (e.g., `Custom/ECS`) and metric name (e.g., `GatewayTimeouts`).
CloudWatch combines the metrics published from all four log groups under a single namespace and metric name.
Using identical namespaces and metric names aggregates the published data points into a single metric stream in CloudWatch.
3
Create a CloudWatch alarm for the combined metric using the Sum statistic with a evaluation period of 10 minutes and a threshold of 45.
An alarm is created that will trigger if the cumulative sum of error data points from all four services exceeds 45 within a 10-minute window.
The Sum statistic totals all data points published by the four metric filters within the specified evaluation interval.

Anahtar Kavram

Aggregating logs across multiple log groups using identical metric filter names/namespaces, and using the Sum statistic in a CloudWatch alarm.
Tahmini Süre:2m 30s
Bu soruyu puanla