Search code examples
amazon-web-servicesaws-cloudwatch-log-insights

Handling single quote in AWS Cloudwatch Logs Insights


Here is some text that contains single-quotes:

Cannot read property 'email' of undefined:

When I run the below query with the above text

filter @message like /Cannot read property 'email' of undefined/
| stats count()

I am not able to get a count. However, in reality there are lots of above text in my logs.

Question is , how to escape the single quotes in the query?


Solution

  • You need to escape the quotes \'.
    Like this:
    /Cannot read property \'email\' of undefined/