diff --git a/README.md b/README.md index a325b94..d96ab21 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,23 @@ awsinsights --env prod --start 2021-01-01 10:00:00 --end 2021-01-02 09:00:00 --a awsinsights --timedelta 2h --log_groups "group-one-dev" "/aws/lambda/group-two-dev" ``` +Tail mode +----------- + +awsinsights allows to listen CloudWatch in live mode which is called `tail +mode`. + +It can be activated using `--tail` option. + +Example - listening for ERRORs and Exceptions in tail mode: +``` +awsinsights --timedelta 30m --appname simplebook --filter "ERROR|Exception" --tail +``` + +NOTE: Please notice that there might be **few mins delay** between the time when log really happened +and the time when it will appear in output of awsinsights' `tail mode`. + + Example of config file ----------- @@ -96,4 +113,6 @@ optional arguments: --query QUERY Custom full AWS CloudWatch Insights query. " "Default: fields @timestamp, @message | filter @message like // | sort @timestamp + --tail TAIL MODE. If set to "true", It will listen for live + logs forever ``` diff --git a/awsinsights/__main__.py b/awsinsights/__main__.py index 3063267..c38b2f0 100644 --- a/awsinsights/__main__.py +++ b/awsinsights/__main__.py @@ -81,8 +81,6 @@ def main(): 'Format: YYYY-MM-DD HH:MM:SS') parser.add_argument('--filter', help='Regular expression for filtering logs', default="") - parser.add_argument('--tail', help='TAIL MODE. If set to "true", It will listen for ' - 'live logs forever', dest='tail', action="store_true") group = parser.add_mutually_exclusive_group(required=True) group.add_argument('--appname', help='name of the app which logs should ' \ @@ -101,6 +99,8 @@ def main(): "like // | sort @timestamp" parser.add_argument('--query', help=f'Custom full AWS CloudWatch Insights query. " \ "Default: {insights_query}', default=insights_query) + parser.add_argument('--tail', help='TAIL MODE. If set to "true", It will listen for ' + 'live logs forever', dest='tail', action="store_true") args = parser.parse_args() if args.query == insights_query: diff --git a/setup.py b/setup.py index fdf07b7..6aa650b 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ # This call to setup() does all the work setup( name="awsinsights", - version="1.0.2", + version="1.0.3", description="Get, sort and analyse AWS CloudWatch logs from multiple log groups using AWS CloudWatch Insights service", long_description=README, long_description_content_type="text/markdown",