1 Answer
- Newest
- Most votes
- Most comments
1
Hello.
As far as I know, only the asterisk wildcard can be used in the Logs section of CloudWatch Agent.
Therefore, I think the problem can be solved by creating separate directories for "_error_yyyymmdd.log" and "_web_error_yyyymmdd.log".
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html#CloudWatch-Agent-Configuration-File-Logssection
In other words, as shown below, it is possible to set the file path in the CloudWatch Agent settings, so I think you can deal with this by changing the output file path on the application side.
"files": {
"collect_list": [
{
"file_path": "/var/log/httpd/error/logs/*_error_*.log",
"log_group_name": "/logs/error",
"log_stream_name": "{instance_id}"
},
{
"file_path": "/var/log/httpd/web_error/logs/*_web_error_*.log",
"log_group_name": "/logs/web_error",
"log_stream_name": "{instance_id}"
}
]
}

Thank you for your answer. So I need to separate the output filepath of these 2 logs type to different directory.