8

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?

user8479984
  • 451
  • 2
  • 9
  • 23
  • 1
    Have you tried to escape them like so: `/Cannot read property \'email\' of undefined/`? – dmigo Oct 19 '19 at 14:44
  • Thanks for replying. I tried, but it does not gives any count. – user8479984 Oct 20 '19 at 08:27
  • And something like "Cannot read property 'email' of undefined"? Sorry for the blind guesses, I don't have AWS console at the moment :) – dmigo Oct 20 '19 at 08:49
  • I tried: filter @message like /"Cannot read property 'email' of undefined"/ | stats count() but didnot work. Thanks again. – user8479984 Oct 20 '19 at 09:08
  • Sorry my bad. The first suggestion did WORK. By mistakenly, I was searching in an environment where the logs were not available. Using the backslash it worked under the environment where the logs were available and eventually started to give the actual count. Thanks a lot. – user8479984 Oct 20 '19 at 09:59
  • Glad to hear that :) I added it as an answer. – dmigo Oct 20 '19 at 15:04

1 Answers1

11

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

dmigo
  • 2,849
  • 4
  • 41
  • 62