Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log retention #370

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Log retention #370

wants to merge 1 commit into from

Conversation

hdbdn77
Copy link

@hdbdn77 hdbdn77 commented Nov 27, 2023

fix #197
Must be executed on the working node

logrotate_config+="}\n"

# Write logrotate configuration to file
echo -e "$logrotate_config" > "/etc/logrotate.d/$dir_path_name"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each log file will have a logrotate config file and no cleanup for useless config file (point to not exist log file after a period time)? i do not think it is a good idea.

only one config with multi path using wildcard is suggested. example like /etc/logrotate.d/rsyslog

but we do not have a fixed log file name, glog log to filename+timestamp. so i think use logrotate is not a good idea. you may need create a script to parse and deal our logs, and put it to cron.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我注意到,curve的日志似乎是单日志记录,而且每个日志都会放置在命名规律的文件夹下,例如etcd0、etcd1、mds0、mds1这种,所以使用了logrotate配置。如果担心日志文件被误删除导致文件名更新,我想可以再使用一个 logrotate 配置定期执行log_retention.sh就可以解决了。

@@ -0,0 +1,15 @@
log_retention.sh文件使用说明:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是否每个curve节点都需要执行这个脚本才能完成日志滚动操作?

具体执行命令是bash log_rentention.sh吗?执行后的效果是什么?能否补充一个示例结果?

是否能定期执行这个脚本?如何定期执行能否举个例子?

log_rentention.sh是否改为logrotate.sh更合适?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前三个问题已更改,请查看。
因为有清理和轮转两种功能,所以使用了log_rentention。

@hdbdn77 hdbdn77 requested a review from aspirer December 2, 2023 05:35
Signed-off-by: Liao PengFei <136953902+hdbdn77@users.noreply.github.com>
@Wine93
Copy link
Collaborator

Wine93 commented Dec 5, 2023

Hi @hdbdn77 首先非常感谢你的贡献 :)
但是我们期望的是在所有的服务容器里自动安装好日志 rotate 脚本,并给于一个默认的 rotate 策略(比如一天压缩或清理一次),我们不希望用户手动去执行这些操作,我们希望这些对于用户是无感知的,随着服务的运行而运行,服务的终止而终止,当然你可以提供一些配置项供用户选择,目前我们控制服务的所有配置项都保存在 topology.yaml,你可以提供一些必要的配置项供用户配置。
关于 crontab 的使用,可以参考以下代码:sync_config.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[develop activities] please rotate service log
5 participants