Fix for full /var/log issue, causing inputs to stop updating is now available

This issue has now been resolved and the fix is available via emonPi/emonbase update.

The emonhub logs have now been removed from syslog and daemon.log, they are being written to /var/log/emonhub/emonhub.log instead as per original implementation. EmonHub handles it’s own log rotation preventing the log partition from filling up.

The technical details of the fix are described here:

1 Like

@TrystanLea, for users with log files already full, this does not clear the log folder. Either a

sudo truncate -s 0 /var/log/[the log file name]

needs to be added to the script or a forced reboot to clear the log files. I think I’d recommend a reboot.

Just to be clear here, emonHub will only handle it’s own rotation at 5M if the emonSD’s logrotate fails to rotate the logs sooner and this can only prevent emonhub from filling the log partition if IT is causing excesive logs and reaches 5M between the hourly >1M checks.

If another log is growing rapidly (for example emoncms.log as seen in How to recover emontx inputs after log full) the partition will still fill up if logrotate isn’t able to keep on top of it. Due to the way the logrotate is currently configured on emonSD, it will fail to rotate the logs if the partition is already full (or very close to full).

Since the logrotate will rotate the emonhub.log at >1M the emonhub.log sizes will remain small, so the likelyhood of emonhub.log reaching 5M to rotate itself when something else is filling the log partition is unlikely.

This “fix” is very much welcomed, but it only puts us (roughly) back where we were before emonhub was converted to systemd. There is still a real risk of the log partition filling up and stopping emoncms from working, and logrotate is still not really helping much with that.


. . . and what happened to

That would negate any need to create the log dir in rc.local (ref /var/log still filling up - #27 by pb66)

@borpin, thanks, recommending a restart sounds like the best course of action.

@pb66 I think once we nail down the ideal logrotate config for the new install script we can apply the same to the existing image.

Creating the logfile and folder using the service file is in the pipeline, it got held up due to our on going discussion on the best location or approach for the exec path / src directory.

1 Like

At a minimum of 1M (in reality they are larger than that as logrotate triggers hourly and they are usually larger than that by then) I suggest that the files are not much use. An hours worth of emonhub logs will not tell you much I’d suggest. I’ve suggested previously using a postrotate directive to concatenate these out of the log folder to generate daily logs but YMMV.

Auto creation of the emonhub log folder using systemd is now merged in & tested:
available via emonpi update as above.