I have a lambda function that writes metrics to Cloudwatch. While, it writes metrics, It generates some logs in a log-group.
INFO:: username: simran+test@abc.co
I used awslogs
. if you install it, you can do. --watch
will tail the new logs.
awslogs get /aws/lambda/log-group-1 --start="5h ago" --watch
You can install it using
pip install awslogs
to filter you can do:
awslogs get /aws/lambda/log-group-1 --filter-pattern '"ClinicID=7667"' --start "5h ago" --timestamp
It supports multiple filter patterns as well.
awslogs get /aws/lambda/log-group-1 --filter-pattern '"ClinicID=7667"' --filter-pattern '" username=simran+test@abc.com"' --start "5h ago" --timestamp
References:
awslogs
awslogs . PyPI