An enterprise application runs on Amazon EC2 instances within an Auto Scaling group. The application writes logs to `/var/log/app/output.log`. Every hour, a cron job rotates the log file by renaming the active file to `/var/log/app/output.log.YYYY-MM-DD-HH` and creating a new empty `/var/log/app/output.log` file. The CloudWatch agent is configured on the instances to stream `/var/log/app/output.log` to a CloudWatch Logs group. However, after the first hourly log rotation occurs, the operations team notices that new log entries are no longer delivered to CloudWatch until the CloudWatch agent is restarted. Which configuration change in the CloudWatch agent configuration file is required to resolve this issue and ensure continuous log delivery?
- Modify the `file_path` parameter in the CloudWatch agent configuration file to use a wildcard pattern, such as `/var/log/app/output.log*`, so that the agent monitors the directory and identifies both the renamed historical files and the newly created active file.Cevap
- BRetain the static `/var/log/app/output.log` file path in the agent configuration and append a `rotation_interval` key set to `1h` to instruct the agent to release the file handle and reopen the file hourly.
- CChange the `file_path` parameter to point to a central Amazon S3 bucket path, such as `s3://company-logs-bucket/app/output.log`, and ensure the S3 bucket policy grants the EC2 instance profile's role the `s3:PutObject` permission.
- DConfigure the `file_path` to point to the system log manager path at `/var/log/messages` and enable the `syslog` protocol module in the agent configuration, relying on the operating system to relay the rotated logs.