简体   繁体   English

Amazon Cloudwatch日志过滤 - JSON语法

[英]Amazon Cloudwatch log filtering - JSON syntax

I have an AWS Lambda function which is logging errors. 我有一个AWS Lambda函数,它记录错误。 Errors are logged as such: 错误记录如下:

console.error(err);

I'm trying to create a Cloudwatch filter which uses their JSON log filtering syntax: 我正在尝试创建一个使用其JSON日志过滤语法的Cloudwatch过滤器:

{ $.errorType = "ValidationException" }

I can see the error in the log 我可以在日志中看到错误

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

Is there some sort of special setup or manual logging into CloudWatch required to support the JSON filter syntax? 是否存在某种特殊设置或手动登录CloudWatch以支持JSON过滤器语法? I cannot find any info in the CloudWatch docs. 我在CloudWatch文档中找不到任何信息。

Docs: 文档:

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

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

Seems like when you log from Lambda it turns everything in to a string. 似乎当您从Lambda登录时,它将所有内容都转换为字符串。 May have something to do with adding the Request time and ID to each item. 可能与为每个项目添加请求时间和ID有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Python 中规范化 Cloudwatch 日志 JSON - Normalizing Cloudwatch Log JSON in Python 使用 JSON 字段的 Amazon Cloudwatch Logs Insights - Amazon Cloudwatch Logs Insights with JSON fields 如何为 cloudwatch 日志事件创建 JSON 过滤器? - How to create JSON filter for cloudwatch log events? 使用 Amazon Cloudwatch Logs Insights 计算 JSON 消息 Object 中的数组长度 - Count Array Length in JSON Message Object with Amazon Cloudwatch Logs Insights 如何在 AWS CloudWatch 中通过 boolean 字段进行 JSON 过滤? - How to do JSON filtering by boolean field in AWS CloudWatch? AWS Cloudwatch Log Insights-根据JSON日志事件的JSON过滤器过滤记录 - AWS Cloudwatch Log Insights - Filter Records by JSON filters on JSON log events 是否有任何程序库支持像mongodb查询语法一样过滤JSON? - Is there any program library support filtering JSON like mongodb query syntax? Amazon CloudWatch不会按实际文件中的格式写入日志 - Amazon cloudwatch not writing the logs as it is in actual file 过滤JSON - Filtering a JSON 是否可以使用 mutate 将 json 日志中的嵌套 json 字段值拆分为 logstash 过滤中的其他子字段? - is it possible to split a nested json field value in json log into further sub fields in logstash filtering using mutate?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM