An enterprise runs a critical application on Amazon EC2 instances in an Auto Scaling group across multiple AWS accounts. The application writes log events to a local file at `/var/log/app/production.log`. A log rotation utility runs hourly, renaming the file to `/var/log/app/production.log.YYYY-MM-DD-HH` and creating a new empty `/var/log/app/production.log` file. Currently, the Unified CloudWatch Agent is installed on the EC2 instances, and its configuration file specifies `/var/log/app/production.log` as the log source. The operations team reports that log events written immediately before and during the hourly rotation are frequently missing from Amazon CloudWatch Logs. Additionally, the company's security policy requires all application logs to be consolidated into a single Amazon S3 bucket located in a dedicated Security account for long-term retention. Which combination of actions should the Solutions Architect recommend to resolve the log loss and establish the centralized logging pipeline?
- Update the CloudWatch Agent configuration on the EC2 instances by setting the `file_path` parameter to `/var/log/app/production.log*`. Configure a CloudWatch Logs subscription filter in each application account to stream the logs to an Amazon Kinesis Data Firehose delivery stream in the same account. Configure each Kinesis Data Firehose stream to deliver the logs to the centralized S3 bucket in the Security account, and update the S3 bucket policy in the Security account to grant `s3:PutObject` permissions to the IAM role principal of the Kinesis Data Firehose stream from each application account.Cevap
- BKeep the CloudWatch Agent configuration's `file_path` set to `/var/log/app/production.log` to maintain static tracking. Configure a cron job on the EC2 instances to copy the active log file to a backup directory 5 minutes before the log rotation utility executes, and set up a secondary CloudWatch agent process to upload logs from the backup directory. Create a cross-account Kinesis Data Firehose stream to collect logs from CloudWatch and store them in the centralized S3 bucket.
- CUpdate the CloudWatch Agent configuration on the EC2 instances by setting the `file_path` parameter to `/var/log/app/production.log*`. Configure the CloudWatch Agent to directly write the logs to the centralized S3 bucket in the Security account. Enable default S3 bucket encryption using the AWS-managed KMS key for S3 (`aws/s3`) in the Security account, and configure the application account IAM roles to assume a role in the Security account to perform the uploads.
- DUpdate the CloudWatch Agent configuration on the EC2 instances by setting the `file_path` parameter to `/var/log/app/production.log*`. Configure CloudWatch Logs in the application accounts to stream logs directly to the centralized S3 bucket in the Security account. Update the S3 bucket policy in the Security account to grant `s3:PutObject` permissions, specifying the application AWS account IDs as the IAM principals in the principal element of the statement.