An enterprise operates a high-volume microservices application running on a fleet of Amazon EC2 instances in an Auto Scaling group within a Production AWS account. The instances run the Unified CloudWatch Agent to collect application logs from `/var/log/app/output.log`. The logs undergo hourly rotation, where the active file is renamed to `/var/log/app/output.log.YYYY-MM-DD-HH` and a new empty `/var/log/app/output.log` is created.
To improve operational excellence, a Solutions Architect must centralize these logs into a CloudWatch log group in a dedicated Security account. The architecture must guarantee zero log loss during rotation, prevent duplicate ingestion of historical log lines, and secure the logs in transit and at rest using a customer-managed KMS key in the Security account.
Which of the following configurations meets these requirements with the least operational complexity?
- Configure the CloudWatch agent with the wildcard path `/var/log/app/output.log*` and specify a cross-account IAM role ARN in the agent's credentials configuration. Grant the cross-account role permissions to write to the central log group and access the customer-managed KMS key in the Security account.Answer
- BConfigure the CloudWatch agent with the static path `/var/log/app/output.log` under the assumption that the agent automatically tracks the file descriptor during rotation, and specify a cross-account IAM role ARN in the agent's credentials configuration.
- CConfigure the CloudWatch agent with the wildcard path `/var/log/app/output.log*` to send logs to a local log group. Establish a cross-account CloudWatch Logs subscription filter to stream logs directly to an S3 bucket in the Security account, using a bucket policy that grants access to the Production account's root IAM principal.
- DConfigure the CloudWatch agent with the wildcard path `/var/log/app/output.log*` to send logs to a local log group. Create a cross-account CloudWatch subscription filter to write directly to the Security account's log group, encrypting the destination log group using the default AWS-managed KMS key `aws/logs` in the Security account.