从 CloudWatchLogs 中删除特定的日志事件
Removing specific log events from CloudWatchLogs
我查看了 the documentation of CloudWatch Logs,但我找不到任何从 log stream
中手动删除部分数据的方法。
删除数据的唯一方法是:
- 删除
log stream
,但这将删除所有数据(不仅仅是
我们要删除的数据)
- 将保留策略设置为更短的时间
window,这样超过X时间的日志事件将被删除。
这也删除了比我们想要删除的更多的内容。
有没有人有删除特定日志记录的经验?
网友ronald8192
的评论确实是事实:
Unfortunately, as of today, you cannot delete a single log event from CloudWatch log stream, the alternative will be using Lambda functions: set a Lambda function trigger, filter all logs, then write the remaining logs to a new log group/stream, then delete the original log stream.
我查看了 the documentation of CloudWatch Logs,但我找不到任何从 log stream
中手动删除部分数据的方法。
删除数据的唯一方法是:
- 删除
log stream
,但这将删除所有数据(不仅仅是 我们要删除的数据) - 将保留策略设置为更短的时间 window,这样超过X时间的日志事件将被删除。 这也删除了比我们想要删除的更多的内容。
有没有人有删除特定日志记录的经验?
网友ronald8192
的评论确实是事实:
Unfortunately, as of today, you cannot delete a single log event from CloudWatch log stream, the alternative will be using Lambda functions: set a Lambda function trigger, filter all logs, then write the remaining logs to a new log group/stream, then delete the original log stream.