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
    Preview
  • 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
    Preview

Gaining insights from the logs

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

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube