Skip to content

aws cloudwatchlog script, using Zappa tail and rich print.

Notifications You must be signed in to change notification settings

esc5221/rich_awslog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rich_awslog

  • Tailing AWS CloudWatch Logs, using Zappa tail and rich print.

Install

git clone https://github.com/esc5221/rich_awslog
cd rich_awslog
pip install -r requirements.txt

Setup

  • run python3 awslog.py and set alias to shell profile

    $ cd rich_awslog
    $ python3 awslog.py
    ___________________________________________________________
    add below alias to ~/.zshrc or ~/.bashrc
    
    alias awslog='python3 {REPOSITORY_PATH}/rich_awslog/awslog.py'
    
    ex)
    alias awslog='python3 /Users/esc5221/rich_awslog/awslog.py'
  • define log_set in .awslog_config.json

    • example
      {
          "log_set_1": {
              "log_groups": [
                  {
                      "alias": "dev",
                      "name": "/aws/lambda/dev_lambda_function"
                  },
                  {
                      "alias": "prod",
                      "name": "/aws/lambda/prod_lambda_function"
                  }
              ]
          }
      }

Usage

usage: awslog.py [-h] [--since SINCE] [--filter FILTER] [--disable-keep-open] [-e] [-s] identifier

Tailing AWS CloudWatch Logs

positional arguments:
  identifier           The identifier of the cloudwatch log group.

options:
  -h, --help           show this help message and exit
  --since SINCE        Only show lines since a certain timeframe.
  --to TO              Only show lines before a certain timeframe.
  --filter FILTER      Apply a filter pattern to the logs.
  --disable-keep-open  Exit after printing the last available log, rather than keeping the log open.
  -e, --exact          Use identifier as an exact match.
  -s, --set            Use identifier as log set name.
  1. Tailing single log
    • searching log group name and select (in case you don't know the exact name)
      $ awslog lambda --since 1h
      [0] /aws/lambda/dev_lambda_function
      [1] /aws/lambda/prod_lambda_function
      Which log group would you like to tail?
      • if there is only one log group, it will be selected automatically
    • provide exact log group name
      $ awslog /aws/lambda/dev_lambda_function -e --since 1h
      • -e option is for exact match
  2. Tailing log_set logs (multiple log groups merged)
    $ awslog log_set_1 -s --since 1h
    • -s option is for using log set

Screenshot

  • single log group tailing single_log

  • log_set tailing log_set

About

aws cloudwatchlog script, using Zappa tail and rich print.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages