AWS Classroomnotes 23/Dec/2021

Fix for the problem of logs not getting uploaded

  • Created the log configuration with run as user root
  • Created config with runas user root
  • Then executed sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json
  • Restarted the cloudwatch log agent
sudo systemctl restart amazon-cloudwatch-agent.service
  • Verified in the agent log

Gaining insights from the logs

  • Refer Here fo the Log insights query syntax
  • General Queries
  • Show 100 logs
    fields @timestamp, @message | limit 100
  • show latest 50 log records
    fields @timestamp, @message| sort @timestamp desc | limit 50
  • Lets try to view the error logs with directory in message
  • Glob patterns & regular expression to extract fields
  • Refer Here for the regex cheat sheet
  • Refer Here

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner