日志文件大小达到特定大小后,将较旧的日志截断

发布于 2025-01-27 16:54:22 字数 530 浏览 3 评论 0 原文

我的应用程序在AWS Fargate(无服务器计算引擎)中的一个Docker容器上运行,其中我将绑定卷用于 TEE 应用程序log,如下所示:

/app.bin 2&gt ;& 1 | Tee/logs/app.log

卷可以最大增长到200  gb ,因此,一旦我的日志文件的大小,我想截断较旧的日志,即 app.log 到达某些特定号码(例如,假设 190 GB )。

关于我们如何实现该对数的任何想法? 我发现也许我可以将 logrotate 命令与 Tee 一起使用。其他方法是什么?我应该怎么做?

I've my application running on one of the Docker containers in AWS Fargate(serverless compute engine) where I'm using a bind volume to tee application logs as follows:

/app.bin 2>&1 | tee /logs/app.log

The AWS bind volumes can grow maximum up to 200 GB, so I want to truncate the older logs once the size of my log file i.e. app.log reaches to some specific number(let's say 190 GB).

Any ideas on how do we achieve this log-rotation?
I figured out that maybe I can use logrotate command along with tee. What are the other ways? How should I do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文