RichWatch is TUI (Textual User Interface) for AWS Cloud Watch.
It formats and pretty prints Cloud Watch's logs so they are much more readable.
Because it works in terminal, you can have updates from your Lambdas and other AWS services next to your hand, automatically refreshed and represented in beautiful way by excelent Python library Rich and Textual,
Content
❓
What is the differenceSo this is example Log output from AWS Cloud Watch:
And here is same output but using RichWatch:
⚠️ There is no theme setup yet so Rich format is based of your terminal Theme. Setup for this screenshot iszsh
withagnoster
inTilda
console.
And both are for same Lambda code:
import json
import logging
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
def lambda_handler(event, context):
logger.info("Output from logging.info()")
logger.debug("Output from logging.debug()")
logger.error("Output from logging.error()")
print("Output from print()")
return {
'statusCode': 200,
'body': json.dumps('This is from response!')
}
⚙️
Setup and Usage AWS credentials for Boto3
To start you need to setup credentials for AWS. You can do this using AWS Command Line, in ~/.aws/credentials
file or via export
command of environment variables. You can read more about this here.
Install requirements
You need Python
and pip
in version 3.6
or higher.
Then you need to install requirements:
pip3 install -r requirements.txt
Setup Log Group file
Then you need to create log_group.txt
file like this:
/aws/lambda/lambda-name-1 region-name-1
/aws/lambda/lambda-name-2
...
/aws/lambda/lambda-name-n region-name-n
Where first word is name o log group, and second optional region(if empty then the default will be taken, if also empty then error will occur). It will display only last part after /
.
Run App
Then you can run app:
python3 rich_watch.py
or get logs once and printout to stdout with:
python3 main.py <log_group>
📝
TODO
⚠️ The TUI version of RichWatch is base on Textual witch is in progress. If you see any bugs please let me know. Currently TUI is only working for Linux and Macs but on Windows you can run this in script version.