How to test Cloudwatch agent

Farzanajuthi
2 min readNov 20, 2023

This is the fourth phase of this project. This phase is a combination of three tasks. I will show every task step by step.

Task 1: Observe httpd access log

Open your application like phase 2 of this project and go every page of this application —

Cafe web application

You can see the log data into access_log file.

Task 2: Observe the amazon-cloudwatch-agent.log file

First you have to find where your amazon-cloudwatch-agent.log file locates. To find it out run following command —

sudo find / -name amazon-cloudwatch-agent.log 2>/dev/null
Cloudwatch agent log

Then run cat command -

sudo cat /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log

You can see a log file like following image. Search “/var/log/www/error/error_log” in this file, you will see this —

Search Access log

Do not worry about the lines (error getting disk usage ("/sys/kernel/debug/tracing"): permission denied) appeared in log file.

Task 3: Placing order in web application and observe the CloudWatch logs

Make purchase in web application and also do some other task and then you will see all these into cloudwatch log folder.

Order

Then go to cloudwatch from console and open cloudwatch log groups like image —

Log group

Then click on “apache/access” folder and see log file into it.

You will see the purchase history into this log file.

Congratulations!!! You have done fourth phase of this project. Go to next phase.

If you find this post helpful, please give a clap in this post and follow me in medium and let’s connect in linked in.

--

--

Farzanajuthi

I am an AWS community builder. I have passed AWS certified solution architect (CO3) exam). I love serverless technology and also share knowledge with others.