将日志发送到 CloudWatch Logs - Amazon CloudWatch
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

将日志发送到 CloudWatch Logs

要将日志从您的容器发送到 Amazon CloudWatch Logs,您可以使用 Fluent Bit 或 Fluentd。有关更多信息,请参阅 Fluent BitFluentd

如果您尚未使用 Fluentd,出于以下原因,我们建议您使用 Fluent Bit:

  • 与 Fluentd 相比,Fluent Bit 具有更小的资源占用空间,并且在内存和 CPU 使用率方面具有更高的资源效率。有关更详细比较,请参阅 Fluent Bit 与 Fluentd 性能比较

  • Fluent Bit 镜像由 Amazon 开发和维护。这使得 Amazon 能够采用新的 Fluent Bit 镜像功能并更快地响应问题。

Fluent Bit 与 Fluentd 性能比较

下表显示了 Fluent Bit 在内存和 CPU 使用率方面优于 Fluentd 的性能优势。以下数字仅供参考,可能会因环境而异。

每秒日志数 Fluentd CPU 使用率 Fluent Bit CPU 使用率与 Fluentd 兼容配置 具有优化配置的 Fluent Bit CPU 使用率

100

0.35 vCPU

0.02 vCPU

0.02 vCPU

1000

0.32 vCPU

0.14 vCPU

0.11 vCPU

5000

0.85 vCPU

0.48 vCPU

0.30 vCPU

10000

0.94 vCPU

0.60 vCPU

0.39 vCPU

每秒日志数 Fluentd 内存使用量 Fluent Bit 内存使用量与 Fluentd 兼容配置 优化配置的 Fluent Bit 内存使用量

100

153MB

46MB

37MB

1000

270MB

45MB

40MB

5000

320MB

55MB

45MB

10000

375MB

92MB

75MB