Are you stuck with the error CloudWatch agent won’t start? We can help you!
Here at Bobcares, we handle similar requests from our customers as a part of our Server Management services.
Today let’s see how our Support Engineers fix this CloudWatch issue for our AWS Customers.
AWS CloudWatch Agent won’t start
CloudWatch Agent is using for real-time monitoring of applications and the resources on the AWS and to collect metrics from servers.
Before running the CloudWatch agent on any servers, we must create a CloudWatch agent configuration file. If the CloudWatch agent fails to begin after installation, it might be due to issues with the configuration. We need to check the log configuration-validation.log for more details.
For Linux server, this log file is under the directory: /opt/aws/amazon-cloudwatch-agent/logs
For Windows servers, this log file is under the directory: ProgramData\Amazon\AmazonCloudWatchAgent\Logs\
The CloudWatch agent configuration file is a JSON file that contains three sections: agent, metrics, and logs. The file specifies the metrics and logs that the agent is to collect.
agent section: It includes the overall configuration of the agent.
metrics section: This section specifies the custom metrics for collection and publishing to CloudWatch.
logs section: This section defines which log files are publishing to CloudWatch Logs.
How to Start the CloudWatch Logs agent
If the CloudWatch agent didn’t start automatically after the installation, or if it doesn’t get restart after stopping the agent, then we have to start it manually.
Now let’s see how our support techs start the CloudWatch Logs agent.
- Firstly, access the AWS EC2 instance.
- Then, from the command prompt, run the following command:
sudo service awslogs start
If the server is Amazon Linux 2, run the following command:
sudo service awslogsd start
[Need assistance with more AWS queries? We can help you]
In short, today, we saw how our Support Techs resolves this CloudWatch agent issue.