Replies: 4 comments 9 replies
-
附上一个systemd的服务 [Unit]
Description=Rotate log files
Documentation=man:logrotate(8)
[Service]
Type=oneshot
ExecStart=/usr/sbin/logrotate /etc/logrotate.d/%i
和一个systemd的计时器 [Unit]
Description=Run logrotate for %i logs
[Timer]
OnCalendar=*-*-* 06:10:00 # 在每天早上 6:10 运行 logrotate for %i
Persistent=true
[Install]
WantedBy=timers.target
把需要logrotate的配置文件丢在
|
Beta Was this translation helpful? Give feedback.
-
我用了2台VPS,分别是Debian10和12的系统,我只在 /etc/logrotate.d/ 目录下创建了一个文件名为 xray ,我观察了2天,日志被正确的每天分成1份了。 我参考了 nginx 的文件,现在是写的这样的内容
我没有测试ubuntu和其它系统,只采用在 /etc/logrotate.d/ 目录增加一个文件是否能正常工作。 我查看了你的 XTLS/Xray-install#62 ,你考虑把 xray 文件内容写成 另外,我想建议将PR中 默认你给的是 |
Beta Was this translation helpful? Give feedback.
-
我是用debian10 12系统,DD完系统,自己就有 /etc/logrotate.d/ 目录。我是这个意思。其它系统我不清楚了。 |
Beta Was this translation helpful? Give feedback.
-
原来这样明白了 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
当你要保存日志到文件中时,一般是用下面的
但是默认不会每天分1个文件,再自己压缩文件,询问了GTP,方法如下
在 /etc/logrotate.d 新建一个文件如 xray,内容如下,保存后就行了,每天会自动执行的,我在Debian10中测试过了。其它不懂的自己问GPT吧。
测试配置文件命令
比如 nginx 的日志自己会如下图
Beta Was this translation helpful? Give feedback.
All reactions