Is there a way to include N lines before and/or after a matching pattern in AWS CloudWatch Logs?
Let's say I have this query and would like 3 lines before and after each match.
aws logs filter-log-events --log-group-name my-group --filter-pattern "mypattern"
The only work around I have at the moment is to remove the filter pattern and use grep:
aws logs filter-log-events --log-group-name my-group | grep -A 3 -B 3 mypattern
However, I would like to only stream the log events I need and do it as part of the aws log events query.
