emonSD next steps: filesystem & logrotate

So my rotation setup currently is

  1. Add SyslogIdentifier=emonhub to the emonhub.service file.
  2. Add file to rsyslog.d to catch emonhub log entries and just save the message part to /var/log/emonhub.log.
  3. Monitor the size of the emonhub.log file with monit and call logrotate at a set size (2M currently).
  4. Add file to logrotate.d to rotate the /var/log/emonhub.log and move it to disk, concatenate it to produce a file of 24Hrs of data. Rotate that file once a day.
/var/log/emonhub.log {
        rotate 6
        daily
        size 2M
        maxsize 2M
        missingok
        copytruncate
        notifempty
        postrotate
             mv /var/log/emonhub.log.1 /home/pi/data/emonhub-log/
             cat /home/pi/data/emonhub-log/emonhub.log.1 >> /home/pi/data/emonhub-log/emonhub.log
             rm /home/pi/data/emonhub-log/emonhub.log.1
        endscript
}

/home/pi/data/emonhub-log/emonhub.log {
        rotate 10
        daily
        compress
        missingok
        notifempty
}



(No idea what that peak is)
and


Peaks coincide with writes to disk of rotated logs.

pi@emonpi:/etc/rsyslog.d $ ls -lah /home/pi/data/emonhub-log/em*
-rw-r--r-- 1 root root  45M Apr 23 22:42 /home/pi/data/emonhub-log/emonhub.log
-rw-r--r-- 1 root root 6.0M Apr 23 00:35 /home/pi/data/emonhub-log/emonhub.log.1.gz
-rw-r--r-- 1 root root 6.3M Apr 22 01:21 /home/pi/data/emonhub-log/emonhub.log.2.gz

Currently got nearly 3 days of logs :smile: should they ever be needed. Size is smaller as I have only been keeping the message part of the log entry instead of the additional rsyslog timestamp PID etc.