如何查询cloudwatch日志以获取api网关日志

时间:2020-05-25 06:36:35

标签: amazon-cloudwatch

如何根据给出此页面的示例解析此值

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax-examples.html

sample code
parse @message "user=*, method:*, latency := *" as @user,
@method, @latency | stats avg(@latency) by @method,
@user

下面,当我尝试执行类似方法时,出现错误。我如何解析此消息。

parse @message "requestId:*" as @myrequestId
| sort @timestamp desc
| limit 20

@message
{ "requestId":"xxxxxx-c401-43f6-ab57-xxxxx", "ip": "137.xxx.85.xxx", "caller":"-", "user":"-","requestTime":"23/May/2020:06:29:05 +0000", "httpMethod":"OPTIONS","resourcePath":"/user/qna-count", "status":"200","protocol":"HTTP/1.1", "responseLength":"0" }

0 个答案:

没有答案