CloudWatch日志中的解析消息见解
这是lambda的两个示例消息: 警告:
Field Value
@ingestionTime 1653987507053
@log XXXXXXX:/aws/lambda/lambda-name
@logStream 2022/05/31/[$LATEST]059106a15343448486b43f8b1168ec64
@message 2022-05-31T08:58:18.293Z b1266ad9-95aa-4c4e-9416-e86409f6455e WARN error catched and errorHandler configured, handling the error: Error: Error while executing handler: TypeError: Cannot read property 'replace' of undefined
@requestId b1266ad9-95aa-4c4e-9416-e86409f6455e
@timestamp 1653987498296
错误:
Field Value
@ingestionTime 1653917638480
@log XXXXXXXX:/aws/lambda/lambda-name
@logStream 2022/05/30/[$LATEST]bf8ba722ecd442dbafeaeeb3e7251024
@message 2022-05-30T13:33:57.406Z 8b5ec77c-fb30-4eb3-bd38-04a10abae403 ERROR Invoke Error {"errorType":"Error","errorMessage":"Error while executing configured error handler: Error: No body found in handler event","stack":["Error: Error while executing configured error handler: Error: No body found in handler event"," at Runtime.<anonymous> (/var/task/index.js:3180:15)"]}
@requestId 8b5ec77c-fb30-4eb3-bd38-04a10abae403
@timestamp 1653917637407
errorMessage
Error while executing configured error handler: Error: No body found in handler event
errorType
Error
stack.0 Error: Error while executing configured error handler: Error: No body found in handler event
stack.1 at Runtime.<anonymous> (/var/task/index.js:3180:15)
您能帮助我了解如何设置查询以便拥有具有以下列及其值的表: 来自@Message提取时间戳记,requestId,type(警告或错误),errormessage,以及是否可行,也可以从@log和@logstream的lambda名称。
Here are two example messages of the lambda:
WARNING:
Field Value
@ingestionTime 1653987507053
@log XXXXXXX:/aws/lambda/lambda-name
@logStream 2022/05/31/[$LATEST]059106a15343448486b43f8b1168ec64
@message 2022-05-31T08:58:18.293Z b1266ad9-95aa-4c4e-9416-e86409f6455e WARN error catched and errorHandler configured, handling the error: Error: Error while executing handler: TypeError: Cannot read property 'replace' of undefined
@requestId b1266ad9-95aa-4c4e-9416-e86409f6455e
@timestamp 1653987498296
ERROR:
Field Value
@ingestionTime 1653917638480
@log XXXXXXXX:/aws/lambda/lambda-name
@logStream 2022/05/30/[$LATEST]bf8ba722ecd442dbafeaeeb3e7251024
@message 2022-05-30T13:33:57.406Z 8b5ec77c-fb30-4eb3-bd38-04a10abae403 ERROR Invoke Error {"errorType":"Error","errorMessage":"Error while executing configured error handler: Error: No body found in handler event","stack":["Error: Error while executing configured error handler: Error: No body found in handler event"," at Runtime.<anonymous> (/var/task/index.js:3180:15)"]}
@requestId 8b5ec77c-fb30-4eb3-bd38-04a10abae403
@timestamp 1653917637407
errorMessage
Error while executing configured error handler: Error: No body found in handler event
errorType
Error
stack.0 Error: Error while executing configured error handler: Error: No body found in handler event
stack.1 at Runtime.<anonymous> (/var/task/index.js:3180:15)
Can you help me understand how to set up the query in order to have a table with the following columns and their values:
from @message extract timestamp, requestID, type (WARN or ERROR), errorMessage and if feasible also the name of the lambda from @log and the @logStream.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我们要查看 Aws Insights parse方法
我们可以使用星号
*
来捕获有关您的详细信息:如果您还想捕获错误消息,请尝试将其解析:
应该工作,但请随时查找AWS文档中的任何其他信息,它们使其非常彻底
If we'd look at the documentation on AWS Insights parse method
We can use asterisks
*
to capture details which for you would be:If you'd like to also capture the error message try to now parse the body as well:
Should work but please feel free to look up any additional information in the AWS documentation, they've made it very thorough????????