• 在服务器端设置 logrotate
    • 工作原理
    • logrotate 默认配置
    • 配置示例

    在服务器端设置 logrotate

    工作原理

    自 3.1 版本以后,seaf-server 和 ccnet-server 支持通过接收 SIGUR1 信号来管理日志文件。

    这个功能在你需要剪切日志文件但是不想关闭服务器的时候非常有用。

    注意: 此功能在 Windows 下并不适用

    logrotate 默认配置

    对于 Debian, logrotate 默认存储在 /etc/logrotate.d/

    配置示例

    假设你的 ccnet-server 的日志文件是 /opt/seafile/logs/ccnet.log, ccnet-server 进程的 pidfile 是 /opt/seafile/pids/ccnet.pid.
    seaf-server 的日志文件是 /opt/seafile/logs/seafile.log, seaf-server 进程的 pidfile 是 /opt/seafile/pids/seaf-server.pid:

    则请按如下配置 logroate:

    1. /opt/seafile/logs/seafile.log
    2. {
    3. daily
    4. missingok
    5. rotate 15
    6. compress
    7. delaycompress
    8. notifempty
    9. sharedscripts
    10. postrotate
    11. [ ! -f /home/haiwen/pids/seaf-server.pid ] || kill -USR1 `cat /home/haiwen/pids/seaf-server.pid`
    12. endscript
    13. }
    14. /opt/seafile/logs/ccnet.log
    15. {
    16. daily
    17. missingok
    18. rotate 15
    19. compress
    20. delaycompress
    21. notifempty
    22. sharedscripts
    23. postrotate
    24. [ ! -f /home/haiwen/pids/ccnet.pid ] || kill -USR1 `cat /home/haiwen/pids/ccnet.pid`
    25. endscript
    26. }
    27. /opt/seafile/logs/index.log
    28. {
    29. daily
    30. missingok
    31. rotate 15
    32. compress
    33. delaycompress
    34. notifempty
    35. sharedscripts
    36. }

    对于 Debian 用户, 可以将以上配置文件存储在 /etc/logrotate.d/seafile