Skip to content

Commit

Permalink
Merge branch 'release/v1.0.3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DamZiobro committed Feb 3, 2021
2 parents 420412d + 7a36af2 commit 77a2aab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----------
Expand Down Expand Up @@ -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
```
4 changes: 2 additions & 2 deletions awsinsights/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ' \
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 77a2aab

Please sign in to comment.