【发布时间】:2016-11-29 22:39:53
【问题描述】:
我有一个记录错误的 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
【问题讨论】:
标签: json node.js amazon-web-services aws-lambda amazon-cloudwatch