Which solution will meet these requirements?

An application runs on multiple Amazon EC2 instances in an Auto Scaling group The Auto Scaling group is configured to use the latest version of a launch template A SysOps administrator must devise a solution that centrally manages the application logs and retains the logs for no more than 90 days

Which solution will meet these requirements?
A . Launch an Amazon Machine Image (AMI) that is preconfigured with the Amazon CloudWatch Logs agent to send logs to an Amazon S3 bucket Apply a 90-day S3 Lifecycle policy on the S3 bucket to expire the application logs
B . Launch an Amazon Machine Image (AMI) that is preconfigured with the Amazon CloudWatch Logs agent to send logs to a log group Create an Amazon EventBridge (Amazon CloudWatch Events) scheduled rule to perform an instance refresh every 90 days
C . Update the launch template user data to install and configure the Amazon CloudWatch Logs agent to send logs to a log group Configure the retention period on the log group to be 90 days
D . Update the launch template user data to install and configure the Amazon CloudWatch Logs agent to send logs to a log group Set the log rotation configuration of the EC2 instances to 90 days

Answer: C

Explanation:

To centrally manage application logs and retain them for no more than 90 days, you can use the Amazon CloudWatch Logs agent to send logs to a CloudWatch log group and configure the log group’s retention period.

Update the Launch Template User Data:

Navigate to the EC2 console.

Select the launch template used by the Auto Scaling group.

Edit the launch template to include the following user data script:

#!/bin/bash

yum update -y

yum install -y awslogs

cat <<EOF > /etc/awslogs/awslogs.conf

[general]

state_file = /var/lib/awslogs/agent-state

[/var/log/messages]

file = /var/log/messages

log_group_name = /my-log-group

log_stream_name = {instance_id}/messages

datetime_format = %b %d %H:%M:%S

[/var/log/secure]

file = /var/log/secure

log_group_name = /my-log-group

log_stream_name = {instance_id}/secure

datetime_format = %b %d %H:%M:%S

EOF

systemctl start awslogsd

systemctl enable awslogsd

Replace /my-log-group with the name of your CloudWatch log group.

Configure the Log Group Retention Period:

Navigate to the CloudWatch console.

In the navigation pane, choose "Logs".

Select the log group created by the CloudWatch Logs agent.

Click on "Actions" and then "Edit retention settings".

Set the retention period to 90 days.

Verify the Configuration:

Ensure that logs from the EC2 instances are being sent to the CloudWatch log group.

Verify that the log group’s retention period is correctly set to 90 days.

Reference: Amazon CloudWatch Logs Agent

Setting Log Retention in CloudWatch

Latest SOA-C02 Dumps Valid Version with 54 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments