Under CloudWatch there are events and logs. Why is there a need to send logs from ec2 to cloudWatch?
-
1Because you want to know what your application is doing while it is running. Events are basically system status updates, instances starting, configs chaning, etc. metrics are metrics and logs are logs, there really is not that much to explain. Those words are well-defined english words. – luk2302 Sep 08 '21 at 18:23
-
1You don't really need to send them to CloudWatch. If you are working on a serious production environment, you certainly would want to preserve logs somehow, by using CloudWatch from example. Otherwise probably your boss wont be happy if you shrug when he asks you why your system was down 2 weeks ago. – Ervin Szilagyi Sep 08 '21 at 18:25
-
@luk2303 So would it be like Logs are made up of events events are made up of rules. – CloudLearner Sep 08 '21 at 18:29
1 Answers
CloudWatch Metrics are statistics sent by AWS services, or your own programs, for storage and monitoring. For example, every Amazon EC2 instance sends CPU Utilization information to CloudWatch so you can view the history and also create an alarm to trigger an action when a threshold has been breached (eg average CPU Utilization above 80% for 5 minutes).
CloudWatch Logs keeps logs from AWS services such as AWS Lambda function executions, or you can send your own logs to the service. Rules can be applied to these logs to trigger alerts when certain information is detected, such as Out of Memory errors. A common use-case is having a fleet of EC2 instances send their logs to CloudWatch Logs to have a centralized place where all the logs are stored, instead of having to go to each instance individually to view/retrieve the logs.
CloudWatch Events (also known as EventBridge) has the ability to watch for activity (eg an Amazon EC2 instance being Stopped) and then trigger an event (eg send a message to an Amazon SQS queue, send a notification via Amazon SNS, trigger an AWS Lambda function), passing along that information. Events can also be scheduled, such as running an AWS Lambda function every half-hour.

- 241,921
- 22
- 380
- 470