简体   繁体   中英

How to pipe rails app's docker container logs to aws cloud-watch

I've rails app running with docker installed EC2 instance. I'm struggling with piping my docker container logs(STDOUT) to AWS cloudwatch console.

I've already tried by installing awslogs agent on ec2 instance as described below by following link. https://blog.shikisoft.com/store-monitor-rails-logs-on-amazon-cloudwatch/#:~:text=Start%20Amazon%20CloudWatch%20Logs%20agent%20to%20stream%20the%20logs&text=After%20a%20while%2C%20you%20will,%3E%20MyAppGroup%20%2D%3E%20instance_id%E2%80%9D .

Problem is that how can i got file path of docker container's log file in production environment.

[my_app_stream]
log_group_name = MyAppGroup
log_stream_name = {instance_id}
datetime_format = %Y-%m-%dT%H:%M:%S.%f
file = /var/www/my-app/current/log/production.log*

Stucked at line file = /var/www/my-app/current/log/production.log*

Can anyone please guide me, how can i achieve this or using other way? Any help would be appreciated.

Finally found the solution, had attached awslogs as logging driver when deploying docker container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM