AWS Cloudwatch Log Scroller

AWS Cloudwatch Log Scroller

This is a quick tip about a quick solution to a regular small problem! AWS CloudWatch logs are great, but the search feature on those logs is not. The search only lists the lines that are exact match to your search term. Usually you would want to see a few lines above or below the match as well! Not all logs are single line, unless you spend efforts in ensuring that there are no newlines in the content being logged out. And so, every so often you have resort to ‘scrolling’ through the logs.

The logs load dynamically on scroll of the mouse wheel, and it is tedious (read ‘irritating’) to keep spinning the mouse wheel to scroll through those logs, especially the ECS container logs. So here is a little script which does that for you. Run this in your browser console and specify it the number of times it should run, and done. It does the scroll action, waits for the page to load (fixed) and scrolls again till it has scrolled for the times you specified.

You can also stop the scroll in between by calling clearTimeout on the timer.

Here it is:

Disclaimer: This is still not the best solution for long running tasks / huge log files, you are limited by the load times anyway. This only takes the need for manually scrolling through logs where you would have otherwise done so. For larger logs, it is probably best to export them.

Leave a Reply

Your email address will not be published. Required fields are marked *

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