Is cloudwatch configured and installed on Amazon Linux 2023

0

Is cloudwatch already configured and installed on when creating an EC2 with Amazon Linux 2023?

Where are the config files? And is syslog /var/log/messages already configured? So that I could look at it in cloudwatch after creating the EC2 with Amazon Linux 2023?

feita há 6 meses1151 visualizações
1 Resposta
0

Hello.

To output logs to CloudWatch Logs, you need to install CloudWatch Agent.
CloudWatch Agent is not installed by default, so you must install it yourself.
You can install it by following the steps in the document below.
Also, to output logs to CloudWatch, you need to set up an IAM role on EC2, so please set it up using the steps in the document below.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-commandline-fleet.html

profile picture
ESPECIALISTA
respondido há 6 meses
profile pictureAWS
ESPECIALISTA
avaliado há 6 meses
  • Thank you, for the Amazon Linux 2023, it does look like the cloudwatch agent is installed, which is listed in this doc https://docs.aws.amazon.com/linux/al2023/release-notes/all-packages-AL2023.2.html

  • The documentation you shared only indicates that the CloudWatch Agent is included in the package. That is, you need to run the dnf install command to install the CloudWatch Agent. https://repost.aws/knowledge-center/cloudwatch-push-metrics-unified-agent

    sudo dnf install amazon-cloudwatch-agent -y
    
  • By the way, Amazon Linxu2023 does not output "/var/log/messages" by default, so you need to install "rsyslog" with the following command.

    sudo dnf -y install rsyslog
    sudo systemctl enable rsyslog
    sudo systemctl restart rsyslog
    

    An example configuration for CloudWatch Agent is as follows.

    {
    	"agent": {
    		"run_as_user": "root"
    	},
    	"logs": {
    		"logs_collected": {
    			"files": {
    				"collect_list": [
    					{
    						"file_path": "/var/log/messages",
    						"log_group_name": "AmazonLinux2023",
    						"log_stream_name": "{instance_id}"
    					}
    				]
    			}
    		}
    	}
    }
    

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas