Closed andi-blafasl closed 5 years ago
just discovered that doing kill -USR1 'cat /srv/seafile/seafile-srver-latest/runtime/seahub.pid'
is a bad idea. It does not tell seahub to reopen it's log files. It kills seahub...
Any Idea how to get seahub working with logrotate? (without restarting after rotation ;-)
I don't think it is possible with seahub. See http://manual.seafile.com/deploy/using_logrotate.html You could stop seahub rotate the log and start seahub.
I know this entry in the manual, but to me it seems to be outdated because it does not cover all log files created by seafile. And the possibility to reopen logs by SIGUSR1, but not reopening all log files used looks also inconsistent to me.
as a workaround you have to use this logrotate config:
/srv/seafile/logs/*.log
{
weekly
missingok
rotate 4
compress
delaycompress
notifempty
sharedscripts
postrotate
/etc/init.d/seafile-server restart
endscript
}
The other logfiles were available at that point, too. Seafile works with different components. Those log files you can reopen with SIGUSR1 have nothing to do with those from seahub. If this is also possible in python you could propose a fix.
The dokumentation covers
and
I'm running version 4.3 and there are the following logs ccnet.log
seafile.log
seafdav.log
controller.log
-> I call this a bug and think it should be fixed
seahub.log seahub_django_request.log
-> I call this a bug and think it should be fixed
-> should be possible, because seafdav does this already
I'm not a python programmer and can not help directly with code fixes. But I'm a linux sysadmin with long time experience in running server systems ;-)
Yes, the docs are not very clear on this: https://manual.seafile.com/deploy/using_logrotate.html it is not up to date with the current file structure and standard log names used as @andi-blafasl said.
Right now I'm using the following code in my logrotate scrtipt
{
weekly
missingok
rotate 2
compress
notifempty
}
/srv/seafile/logs/ccnet.log
/srv/seafile/logs/seafile.log
/srv/seafile/logs/seafdav.log
/srv/seafile/logs/seahub.log
/srv/seafile/logs/seahub_django_request.log
/srv/seafile/logs/controller.log
{
weekly
missingok
rotate 4
compress
delaycompress
notifempty
sharedscripts
postrotate
# double stop only needed for Ubuntu 14.04
/etc/init.d/seafile-server stop; sleep 10; /etc/init.d/seafile-server stop; sleep 10 ; /etc/init.d/seafile-server start
# simple restart used on Debian 7.11
#/etc/init.d/seafile-server restart
endscript
}
The double "stop" on Ubuntu 14.04 is needed because seafile does not stop all process with a simple restart or stop and won't start afterwards. I tried do wait longer between stop and start, but the only way to get it working was the line above.
I see but which one is the correct approach, this one or the one from the docs?
For me it is my approach ;-) Because it covers all log files that seafile creates. The approach from the manual does not cover seafdav.log seahub.log seahub_django_request.log controller.log
But I'm not sure about any side effects that seafile suffers from the restarts. Maybe some caches are cleared or something like that. I do not restart MySQL, so any caches on the DB backend should be fine :-)
I still don't see why we can't just rotate them all. There are other log files that need to be rotated... eventually.
My log dir contains:
controller.log
elasticsearch_index_indexing_slowlog.log
elasticsearch_index_search_slowlog.log
elasticsearch.log
seafevents.log
seafile.init.log
seafile.log
seahub_django_request.log
seahub.init.log
seahub.log
And i rotate them like:
/home/seafile/seafile/logs/*.log
{
weekly
missingok
rotate 4
compress
delaycompress
notifempty
sharedscripts
postrotate
/etc/init.d/seafile-server stop; sleep 10; /etc/init.d/seafile-server start
endscript
}
I ran into some issues with /etc/init.d/seafile-server restart
, sometimes, not sure why but the server does not stop.
Logrotate of controller.log already supported.
I would like to rotate the logs files from seafile with logrotate. It could be as simple as
But the
controller.log
file, which is used by ccnet, seaf-server and seafdav is not reopened afterkill -USR1
. lsof shows pids with access to the rotated controller.log.1 fileBecause of this, you have to use the following postrotate script:
which will cause the seafile server to completely restart with a short interruption for the clients
BTW: why is the
seahub.pid
not in the top level/pids/
directory?