1
votes

i set up an elastic load balancer on AWS to reach a target group made of 3 EC2 instances, in 3 different zones.

I saw I can see CloudWatch load balancer metric, target group metric, or EC2 metric. I'd like to know if exists a kind of plugin to display metrics for all the hosts available in the target group, like grafana/prometheus.

In addition I'd like to know if the are best practise to gather application logs from EC2 instances to consult them, if some error occur.

Thank you very much

1

1 Answers

1
votes

It depends on what kind of monitoring you want to use, but assuming you just want to gather logs, you can do the following:

  1. Pre-bake the AMI, based on your OS, with Cloudwatch Logs agent.
  2. Specify log group name in agent configuration, enable agent on startup
  3. Launch instance group from that AMI

This way logs from different instances should be collected in one log group under different streams corresponding to instance.

You can also use 3rd-party services, like ELK stack, but the idea is the same - AMI with log agent.