A developer has deployed a microservice as an Amazon ECS task. The application writes JSON-formatted logs to an Amazon CloudWatch Logs group named `/aws/ecs/payment-service`. A sample log event is shown below:
{
"level": "error",
"responseCode": 504,
"latency": 1500,
"context": {
"api": "charge"
}
}
The developer needs to:
1. Create a CloudWatch metric filter to increment a custom metric named `PaymentTimeoutCount` whenever `responseCode` is and `latency` is greater than . Currently, the developer's metric filter pattern `[level = "error", responseCode = 504, latency > 1000]` is matching zero events.
2. Stream these matching log events in real time to an Amazon Kinesis Data Firehose delivery stream for archiving in Amazon S3. The developer has created a CloudWatch subscription filter pointing to Kinesis Data Firehose, but logs are not arriving in the S3 bucket, and CloudWatch Logs reports delivery errors.
Which two actions must the developer perform to resolve these issues? (Select two.)
- Update the metric filter pattern to use JSON object syntax: `{ .responseCode = 504 && .latency > 1000 }`.Answer
- BChange the metric filter pattern to use a SQL-like query structure: `SELECT * WHERE responseCode = 504 AND latency > 1000`.
- Update the IAM role associated with the subscription filter to trust the `logs.amazonaws.com` service principal to perform the `sts:AssumeRole` action.Answer
- DModify the Kinesis Data Firehose delivery stream's IAM role to grant the `logs:PutSubscriptionFilter` permission to the CloudWatch Logs service.
- EUpdate the ECS task execution role to permit the `firehose:PutRecord` action on the destination delivery stream.