Page 1 of 1

razzberry pi and log rotation

Posted: 12 Nov 2013 14:25
by dirkx
Build in/easy log rotation by default may be quite essential on the razzbery-pi; as to avoid it to 'hang' once the (often very small ) SD disk is full.

as its linux, installing

Posted: 12 Nov 2013 14:25
by jtylerhall
as its linux, installing logrotate is probably the best option.

I checked my raz and its already installed, it just needs to be configured to rotate the z-way-server log.

logrotate

Posted: 12 Nov 2013 14:25
by dirkx
The issue here is that you need to re-HUP Z-Way server; to have it re-open the file handle of the log file; or have to use a unix pipe to the apache-log rotate; with the right sundry added to the server to survive / have good child daycare.

Both are not quite there in Z-Way server; and restarting z-way server on a rasberry pi or similar low end platform means an outage of several minutes; as it restarts; with quite a bit of state loss.

So my guess (experience) is that logrotate is not quite cutting it ? Or am I missing a signal/USR1 or other trick here ?

that seems like a bug to me.

Posted: 12 Nov 2013 14:25
by jtylerhall
that seems like a bug to me. A log file should recreate itself when deleted, regardless of the state of , and if there is some technical reason why it can't, it shouldn't be *.log file, but rather some type of data file, and then yes , it should be self maintaining at its minimum size.

bug - close on file open

Posted: 12 Nov 2013 14:25
by dirkx
jtylerhall: that is not quite so easy on unix (linux). When you delete a file; the process that has the file open does generally notice nothing; its file handle stays valid, writable (and will take up space on disk) until the last process closes the file. Only then does the removal of the entry from the directory propagate and actually releases the inodes used on disk.

Hence the general pattern where after/on log file rotation one sents a kill -1 (or HUP) to the process to have it re-open its log files. Most unix log rotates (e.g. http://www.freebsd.org/cgi/man.cgi?quer ... &sektion=8) have this as an easy to use feature.

Z-Way supports SIGHUP to be

Posted: 12 Nov 2013 14:25
by PoltoS
Z-Way supports SIGHUP to be compatibl with logrotate, so it should work.