0

I'm trying to do a aws query log on power shell. But on query string part, I have quotation marks inside quotation marks, and one of that quotation mar is closing the string. Command:

aws logs start-query --log-group-name /aws/containerinsights/eb21-eks-cluster/application --start-time 1618560000 --end-time 1617235200 --query-string 'fields @timestamp, kubernetes.host, kubernetes.container_name | parse @message '"log":"*"' as text | fields @message | filter kubernetes.pod_name like 'ebs-csi-' | sort @timestamp desc'

The problem is locate on: '"log":"*"'

where the problem is

Mathias R. Jessen
  • 135,435
  • 9
  • 130
  • 184
  • 2
    You can escape quotation marks of the enclosing type by doubling them: `'Here goes ''"log":"*"'', noticed the repeated single-quotes'` – Mathias R. Jessen Apr 16 '21 at 13:04
  • Perfect! Thank u! – GlassCode Apr 16 '21 at 13:07
  • Note, however, that due to a longstanding PowerShell bug you'll currently have to additionally `\ `-escape embedded `"` characters - see [this answer](https://stackoverflow.com/a/66837948/45375). – mklement0 Apr 16 '21 at 14:08

0 Answers0