Cloudwatch logs
Sending logs to cloudwatch
- Scenario: Send website logs that is hosted on nginx to cloudwatch logs
- Setting up the website
sudo apt update
sudo apt install nginx unzip -y
cd /tmp
wget https://www.free-css.com/assets/files/free-css-templates/download/page296/listrace.zip
unzip listrace.zip
sudo mv listrace-v1.0/ /var/www/html/
sudo mv /var/www/html/listrace-v1.0 /var/www/html/lists
* AWS Cloudwatch logs are stored in log groups which will have streams
* Steps:
* Install cloudwatch agent on ec2
wget https://amazoncloudwatch-agent.s3.amazonaws.com/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
sudo dpkg -i amazon-cloudwatch-agent.deb
* give necessary permissions to ec2 to send logs (cloudwatchlogsfullaccess)
* confgure agent to send specific logs
How to do the similar stuff in Azure
* Create a log analytics worksapce
* INstall azure monitoring agent
* Configure azure monitoring agent to send logs to log analytics workspace
