I have to send logs from AWS EC2 server to the AWS CloudWatch logs. For this, I have created a CloudWatch configuration file for collecting logs such as
{
"agent": {
"run_as_user": "root"
},
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{
"file_path": "/var/log/testing.log",
"log_group_name": "/project/development",
"log_stream_name": "{instance_id}_testing-logs"
}
]
}
}
}
}
I have created an application in AWS CodeDeploy named project with three groups inside that namely development, staging, and production. I want CloudWatch to use the naming convention such as /project/development and similarly to name it for staging and production to name its log group log_group_name. For this, I do not want to create three separate files for each environment.
Is there any CloudWatch variable available for CodeDeploy which I can use it to name log_group_name like there are naming variables available for {instance_id} which automatically picks the Instance Id.