Amazon Cloudwatch日志过滤 – JSON语法

我有一个logging错误的AWS Lambda函数。 错误logging如下:

console.error(err);

我正在尝试创build一个使用JSON日志过滤语法的Cloudwatchfilter:

{ $.errorType = "ValidationException" }

我可以看到日志中的错误

2015-11-24T20:26:02.852Z 76800706-2d78-45ed-9068-46ccccafe6af { "errorMessage": "1 validation error detected: Value '[]' at 'xxxxxx' failed to satisfy constraint: Member must have length greater than or equal to 1", "errorType": "ValidationException", "stackTrace": [ ...etc... ] }

是否需要某种特殊设置或手动login到CloudWatch以支持JSONfilter语法? 我无法在CloudWatch文档中find任何信息。

文档:

http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-logging.html

http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/FilterAndPatternSyntax.html#d0e19372

看起来像从Lambdalogin时,它将所有内容都转换为string。 可能与将请求时间和ID添加到每个项目有关。