The CloudWatch agent is running on Linux EC2 and already sends OS metrics. Its operating-system user can read /var/log/app.log, and CloudWatch Logs IAM permissions and connectivity are ready.
Add new log lines to a chosen log group with separate streams per instance, while preserving existing metric collection.
Which configuration and application method is most appropriate?
Configure the agent logs section and apply a configuration that preserves existing metric collection.
Detailed explanation
A destination alone does not add file reading and delivery on EC2.
Metric dimensions identify numeric measurements; they do not collect file contents.
Saving the source file alone does not update the running collection settings.
The agent needs both the file/destination mapping and an applied runtime configuration.
Check official documentation
Compare the following points with the official documentation.
Review logs/collect_list, file_path, stream-name variables, and fetch-config/append-config application.
Official references
What to confirm
Map a file to its destination and distinguish saving/applying settings and OS/AWS permissions.
Key points
- CloudWatch agent
- File log
- Log group
Notes
- Environment: AWS SOA-C03 exam guide and the linked AWS documentation
- Reviewed against the linked AWS documentation on 2026-10-04.
Foundation review
Map the source and destination
In collect_list, file_path identifies the OS file; log_group_name and log_stream_name identify CloudWatch destinations. Use {instance_id} in stream names to distinguish instances. The metrics section does not enable file-log collection.
Apply settings and confirm runtime behavior
fetch-config replaces the active configuration set, so include existing metrics in the replacement. append-config can add a configuration; review matching file-name behavior. Apply and start or restart the agent, then check a test record and agent logs. OS read access is separate from IAM permissions and network delivery.