'Current Ec2 logs path /home

Current EC2 logs are stored in /home/test/files/domain/logs/ - those logs are stored under in logs folder. I need entire logs are copy to the cloudwatch with before I have install cloudwatch agent but logs are not generate in cloudwatch

I'm refer with below the link

https://www.google.com/amp/s/www.rapidspike.com/blog/how-to-send-log-files-to-aws-cloudwatch-ubuntu/amp/

Config.json files - I need entire logs push to the cloudwatch

{
     "agent": {
         "run_as_user": "root"
     },
     "logs": {
         "logs_collected": {
             "files": {
                 "collect_list": [
                     {
                         "file_path": "/var/log/apache2/error.log",
                         "log_group_name": "apache-error-log",
                         "log_stream_name": "{instance_id}"
                     }
                 ]
             }
         }
     }
 }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source