首页 文章

Amazon Cloudwatch日志过滤 - JSON语法

提问于
浏览
3

我有一个AWS Lambda函数,它记录错误 . 错误记录如下:

console.error(err);

我正在尝试创建一个使用其JSON日志过滤语法的Cloudwatch过滤器:

{ $.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... ] }

是否存在某种特殊设置或手动登录CloudWatch以支持JSON过滤器语法?我在CloudWatch文档中找不到任何信息 .

文档:

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

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

1 回答

  • 0

    似乎当您从Lambda登录时,它将所有内容都转换为字符串 . 可能与为每个项目添加请求时间和ID有关 .

相关问题