Log4J2 CloudWatch Appender

I've been reading that the best approach to integrate with AWS Cloud Watch logs is using the Cloud Watch Log Agent.

It seems that having an independent agent will be much more reliable that the Application logging directly to Cloud Watch.

[Update] Why it may be more reliable?

  • If CloudWatch or the WebServer connection is down, the Appender may miss the Log Event. A write to disk would never be miss.

  • Nothing is faster than write to a stream file on local disk. When high log volume, sending data through a TCP connection could have performance impact or bottolnecks in the Application.


I would support the answer from Gonzalo.

I just want to update the answer with the new unified agent that can collect both logs and performances.

Collecting Metrics and Logs from Amazon EC2 Instances