A SysOps Administrator is configuring monitoring for a containerized microservices application that writes logs to an Amazon CloudWatch Logs group in JSON format. A typical log event with a successful response looks like this:
{
"tenantId": "tenant-12",
"requestPath": "/checkout",
"responseCode": 200,
"executionTimeMs": 1250
}
For requests that fail due to an early gateway timeout, the `executionTimeMs` field is omitted from the JSON payload:
{
"tenantId": "tenant-12",
"requestPath": "/checkout",
"responseCode": 504
}
The Administrator needs to create a metric filter to track the latency of failed gateway requests (where `responseCode` is or ). The resulting metric must be named `GatewayLatency` in the custom namespace `AppMetrics`, with the dimension `Tenant` mapped to `tenantId` and the dimension `Path` mapped to `requestPath`. When the `executionTimeMs` field is missing, the metric must record a value of milliseconds. Metric points should not be published for successful requests or other status codes.
Which configuration combination should the SysOps Administrator implement to meet these requirements?
- Set the filter pattern to `{ .responseCode = 504 }`. In the metric transformation, set the metric value to ` 1500 .tenantId` and `$.requestPath`, respectively.Answer
- BSet the filter pattern to `{ (.responseCode = 504) && .executionTimeMs EXISTS }`. In the metric transformation, set the metric value to `.executionTimeMs` and the default value to . Configure the dimensions `Tenant` and `Path` to use the JSON paths `.requestPath`, respectively.
- CSet the filter pattern to `{ .responseCode = 504 }`. In the metric transformation, set the metric value to ` 1500 1$-minute aggregation interval.
- DSet the filter pattern to `{ .responseCode = 504 }`. Create an Amazon EventBridge rule that triggers an AWS Systems Manager Automation runbook to extract the missing latency field and call the PutMetricData API to publish the custom metric with a value of .