L Xandor
L Xandor

Reputation: 1841

Log print statements from script running on ec2 server?

I have a python script that runs from an ec2 server. What is the easiest way for me to see print statements from that script? I tried viewing the system log but I don't see anything there and I can't find anything in cloudwatch. Thanks!

Upvotes: 0

Views: 2884

Answers (2)

Pravin Garodi
Pravin Garodi

Reputation: 196

It is possible to send log of application running on EC2 to Cloudwatch directly for that you need to do following step.

  1. Create IAM Role with relevant permission and attach to Linux instance.

  2. Install the CloudWatch agent in the instances.

  3. Prepare the configuration file in the instance.

  4. Start the CloudWatch agent service in the instance.

  5. Monitor the logs using CloudWatch web console.

For your reference:- http://medium.com/tensult/to-send-linux-logs-to-aws-cloudwatch-17b3ea5f4863

Upvotes: 1

jarmod
jarmod

Reputation: 78842

Standard output from arbitrary applications running on EC2 don't appear in CloudWatch Logs.

You can install the CloudWatch Logs Agent, configure it to collect logs from given locations, and then configure your app to log to one of those locations.

Upvotes: 1

Related Questions