There does not appear to be any clean way to force hhvm to reopen its logs without restarting it?
Most programs respond to USR1 by closing and reopening files.
Does hhvm respond to any such signals or commands?
Currently, no. Since you can set log rotate to copytruncate, I don't see it being a priority either though a PR for it would help.
What about using the "takeover" ability of hhvm? Where a new copy of hhvm resumes old hhvm in place.
Does that still exist in the fastcgi version?
Or would that also not bother to reopen logs?
It needs fixing up in fastcgi - the endpoint is there, but it's now speaking fastcgi, and the client inside HHVM still tries to talk http to it.
is the webserver tag correct? it seems like the issue is more related to a missing feature of fastcgi.
Unsure; also, copytruncate isn't really a good solution - it can lead to huge load spikes, so we try our best to avoid it.
There is a workaround: using rsyslog and named pipe you can safely rotate logs without restarting hhvm server.
Here is my configuration, that works pretty good (debian):
1) mkfifo /var/log/hhvm/pipe
2) chown www-data:www-data /var/log/hhvm/pipe
3) edit /etc/hhvm/server.ini
hhvm.log.file = /var/log/hhvm/pipe
4) create new file /etc/rsyslog.d/hhvm.conf with content:
$ModLoad imfile
$InputFileName /var/log/hhvm/pipe
$InputFileTag hhvm:
$InputFileFacility local7
$InputFileStateFile hhvm-pipe-stat
$InputRunFileMonitor
local7.* /var/log/hhvm/rsyslog.log
5) restart rsyslog and hhvm (first rsyslog!!)
service rsyslog restart
service hhvm restart
Now all hhvm logs are in the /var/log/hhvm/rsyslog.log
You can tail -f it, and make logrotate configuration for it.
This can be done with a format specifier and syslog logging in HHVM. Closing.
@Orvid could you add concrete information on how to do this to somewhere or at least tell where to find it?
It should be possible to have hhvm writing to plain old files and request it to reopen those by name, allowing the old ones to be rotated out the way.鈥侰an this please be reconsidered for attention, or if it's difficult technically rather than a matter of effort, e.g. handling a signal, then explain why.
Most helpful comment
It should be possible to have hhvm writing to plain old files and request it to reopen those by name, allowing the old ones to be rotated out the way.鈥侰an this please be reconsidered for attention, or if it's difficult technically rather than a matter of effort, e.g. handling a signal, then explain why.