An enterprise maintains a legacy critical application hosted on Amazon EC2 instances in an Auto Scaling group across multiple member accounts in AWS Organizations. The application rotates its internal logs hourly, renaming the active log file `/var/log/app/transaction.log` to `/var/log/app/transaction.log.YYYY-MM-DD-HH` and compressing it. System operators need to aggregate these rotated logs into a centralized Amazon S3 bucket located in a dedicated Security account. The collection must occur in near real-time, preserve the rotated files, and tolerate instance termination. The current setup uses a CloudWatch agent configuration that fails to send rotated logs consistently, and logs are occasionally lost. Which of the following solutions should a Solutions Architect implement to resolve this logging gap and ensure operational excellence?
- Update the CloudWatch agent configuration on the EC2 instances to specify `/var/log/app/transaction.log*` in the file path and enable log auto-rotation tracking. Configure the CloudWatch log group to stream to an Amazon Kinesis Data Firehose in the Security account via a cross-account CloudWatch subscription filter, which then delivers the logs to the centralized S3 bucket.Answer
- BModify the CloudWatch agent configuration on the EC2 instances to track only `/var/log/app/transaction.log` and schedule a hourly cron job on the instances to copy the compressed `/var/log/app/transaction.log.*` files directly to the centralized S3 bucket using the AWS CLI.
- CConfigure the CloudWatch agent to monitor `/var/log/app/transaction.log` with a custom script that restarts the agent hourly after log rotation occurs. Configure a cross-account S3 bucket policy in the Security account that permits local IAM roles from the member accounts to call s3:PutObject directly.
- DDeploy a systems manager agent configuration to copy `/var/log/app/transaction.log` to Amazon CloudWatch Logs. In the Security account, configure an Amazon EventBridge rule that triggers a Lambda function to query CloudWatch Logs from the member accounts and export them to S3 hourly.