Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters not working with grep #181

Open
jjun3188 opened this issue Feb 22, 2021 · 5 comments
Open

Special characters not working with grep #181

jjun3188 opened this issue Feb 22, 2021 · 5 comments

Comments

@jjun3188
Copy link

jjun3188 commented Feb 22, 2021

When I try grep with any special character,
eg. cw tail -pprod /aws/lambda/some-app-name -b10m --grep [email protected]

I get the error below:
Invalid filter pattern

It works fine if I remove special characters, but even -g and --grep="" did not work with special characters.

I also tried escaping special characters using /, //, \ and \\, but no luck.

Is it something that I am doing wrong?
I couldn't find related documentation or issues in this GitHub page.

@lucagrulla
Copy link
Owner

Hi @jjun3188

This is the supported syntax:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html

Have you tried double quotes?
--grep="[email protected]"

@jjun3188
Copy link
Author

jjun3188 commented Feb 23, 2021

I tried --grep="[email protected]" as well. same error..
Also, forgot to mention that I am using MacOS

@lucagrulla
Copy link
Owner

Hello @jjun3188

I just released a new version with an upgrade to the V2 of the AWS SDK.
Can you test again and see if the problem is solved?

@theo-bittencourt
Copy link

Same problem here.

Version: 4.1.0
SO: MacOS

In my case, I need to use / char.
Tried without escape and with escape (\/).
And tried with and without quotes and double-quotes.

The error message is the same for all attempts:

operation error CloudWatch Logs: FilterLogEvents, https response error StatusCode: 400, RequestID: e55cdea4-8b02-45c8-b350-fc08c0e2e9ce, InvalidParameterException: Invalid filter pattern

@theo-bittencourt
Copy link

theo-bittencourt commented Jun 7, 2021

It worked by using the following pattern:

--grep '"GET my/resource/foo"'

o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants