- Newest
- Most votes
- Most comments
When using OpenSearch PPL in CloudWatch Logs Insights, you need to use the correct syntax for regex pattern matching. For regex operations in PPL, you should use the =~ operator rather than like.
Try this syntax instead:
search source = `logGroups(logGroupIdentifier:['API-Gateway-Execution-Logs_qsqns5ug51/ro'])` | where message =~ /adsets\/\{id\}\/offers/
Note that in regex patterns, you need to escape forward slashes with backslashes. The pattern is enclosed in forward slashes (/pattern/).
If you specifically want to use a wildcard-style pattern rather than a full regex, you can use the like operator with string patterns instead of regex patterns:
search source = `logGroups(logGroupIdentifier:['API-Gateway-Execution-Logs_qsqns5ug51/ro'])` | where message like "*adsets/{id}/offers*"
In PPL, the wildcard character is * (asterisk) rather than % which is used in SQL-like syntaxes.
Remember that OpenSearch PPL can only be used for queries of log groups in the Standard Log Class.
Sources
OpenSearch PPL language - Amazon CloudWatch Logs
filter - Amazon CloudWatch Logs
Filter pattern syntax for metric filters, subscription filters, filter log events, and Live Tail - Amazon CloudWatch Logs
answered a year ago
Relevant content
- AWS OFFICIALUpdated a year ago
