설치
# 설치
sudo yum install -y amazon-cloudwatch-agent
# 로그 설치
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard
sudo cp /opt/aws/amazon-cloudwatch-agent/bin/config.json \\
/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json
sudo systemctl start amazon-cloudwatch-agent
config.json 예제
{
"agent": {
"run_as_user": "root"
},
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "/tmp/app.log",
"log_group_name": "app.log",
"log_stream_name": "{instance_id}",
"retention_in_days": 1
}
]
}
}
}
}