aws / aws-sdk

Landing page for the AWS SDKs on GitHub
https://aws.amazon.com/tools/
Other
73 stars 16 forks source link

aws cloudwatch logs filter pattern include lines before and/or after matching pattern #225

Closed HaithamMaya closed 6 months ago

HaithamMaya commented 4 years ago

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.

Ref: https://stackoverflow.com/questions/59217130/aws-cloudwatch-logs-filter-pattern-include-lines-before-and-or-after-matching-pa

KaibaLopez commented 4 years ago

Hi @HaithamMaya , I don't think there is, so I'd say this a pretty good feature request. I'll take a another look to make sure but yea, it would be a cool feature.

fourgates commented 4 years ago

this would be a great tool. I sometimes find myself looking for an exception only to have to get the timestamp and scroll to the exception to see what happened before and after the exception occurred.

felipepulpo commented 3 years ago

This is necessary

iloveitaly commented 3 years ago

Agreed, it would very helpful to have this functionality built-in.

shuangwu-fremtind commented 3 years ago

Agreed + 1. Need it a lot.

andyhush-athena commented 3 years ago

I would love this functionality.

diegonat commented 3 years ago

+1

jeremymcgee73 commented 3 years ago

+1 Want!

JohnHillegass commented 3 years ago

+1 as well. Definitely would be a huge win for Cloud Native log filtering!

kdaily commented 3 years ago

Thanks all for your feedback and enthusiasm around this issue!

This would be difficult to implement in the AWS CLI. There is one customization available for log filtering with the aws logs tail command. This is significantly more complex. We would need to implement our own filter pattern instead of relying on the existing one.

I've requested this feature with the CloudWatch logs team to see if it could be performed server-side and will update when I hear back.

kdaily commented 3 years ago

V345354868

techish commented 3 years ago

+1 !

juliomfreitas commented 3 years ago

+1

rotherfuchs commented 3 years ago

+1

bharathsharma commented 3 years ago

+1

benwillkommen commented 3 years ago

+1

Found this issue Googling because I desperately need to do this right now. 😭

nileshprasad137 commented 3 years ago

+1

omkar-asort commented 3 years ago

+1

kdaily commented 3 years ago

The logging team is aware of the feature request. I don't have any other details on if or when it would be implemented on their side.

sdurgi17 commented 2 years ago

+1 This would be a great addition. Not just in the cli, but also in the interface.

kevalnshah commented 2 years ago

+1

rvong commented 2 years ago

THIS IS NOT BAR RAISING CUSTOMER OBSESSION

kdaily commented 2 years ago

Hi all, thanks for the feedback. I'm checking in with the CloudWatch team to see if there are any other updates that I can provide on this issue, and will post here if I hear back.

Since this is an issue for the service team and not specific to the AWS CLI, I'm going to move this issue to the AWS SDK repository. The current link to this issue will redirect to the transferred repository.

ACronje commented 2 years ago

+1

ArthV commented 2 years ago

+1

webocs commented 2 years ago

+1

ewerkhoven commented 2 years ago

cloudwatch cannot be considered a minimally viable product without this functionality

tim-finnigan commented 2 years ago

P51017282

morenobonaventura commented 2 years ago

+1

ronanj2 commented 2 years ago

+1

cemysf commented 2 years ago

+1

mahmoudawny commented 2 years ago

+1

Von-Starck commented 2 years ago

+1

jamesmacwilliam commented 2 years ago

how has this not made it in yet +1

brgibson commented 2 years ago

+1 please 🙇

quanticworld commented 2 years ago

+1 :pray:

aerlaut commented 2 years ago

+1

wdougoveto commented 1 year ago

+1

dhepp commented 1 year ago

+1

karumugasundaram commented 1 year ago

+1

hmcmanus commented 1 year ago

+1

webocs commented 1 year ago

Almost 3 years and still no news of this feature.. :(

nick-myers-dt commented 1 year ago

I find myself needing this on a daily basis. +1

ridwannizam commented 1 year ago

This is very important feature, Elastic Search and Grafana have support for this issue.

thiagosantosleite commented 1 year ago

+1

williancolognesitrimble commented 1 year ago

+1

wiwichips commented 1 year ago

+1

jnguyen1098 commented 1 year ago

+1

ga-142 commented 1 year ago

+1

jcoffa commented 1 year ago

+1 how has this not been implemented yet, grep has had this feature for longer than most people in this thread have been alive