Managed Service for Apache Flink 中的日志记录 - Managed Service for Apache Flink

Amazon Managed Service for Apache Flink(Amazon MSF)之前称为 Amazon Kinesis Data Analytics for Apache Flink。

Managed Service for Apache Flink 中的日志记录

日志记录对于生产应用程序了解错误和故障非常重要。但是,日志记录子系统需要收集日志条目并将其转发到 CloudWatch 日志。虽然有些日志记录是适宜可取的,但大量的日志记录可能会使服务过载并导致 Flink 应用程序性能下降。日志记录异常和警告当然是个好主意。但是,您无法为 Flink 应用程序处理的每条消息生成日志消息。Flink 针对高吞吐量和低延迟进行了优化,但日志记录子系统却没有。如果确实需要为每条已处理的消息生成日志输出,请在 Flink 应用程序中使用额外的 DataStream 和适当的接收器将数据发送到 Amazon S3 或 CloudWatch。请勿为此使用 Java 日志记录系统。此外,Managed Service for Apache Flink Debug Monitoring Log Level 设置会生成大量流量,这可能会造成反向压力。只有在积极调查应用程序问题时才应使用它。

使用 CloudWatch Logs Insights 查询日志

CloudWatch Logs Insights 是一项用于大规模查询日志的强大服务。客户应利用其功能快速搜索日志,以识别和减少操作事件期间的错误。

以下查询在所有任务管理器日志中查找异常,并根据异常发生的时间对其进行排序。

fields @timestamp, @message | filter isPresent(throwableInformation.0) or isPresent(throwableInformation) or @message like /(Error|Exception)/ | sort @timestamp desc

有关其他有用的查询,请参阅示例查询