Continuing the discussion from EmonPi stopped updating inputs - /var/log/ full:
@glyn.hudson @TrystanLea The current solution does not work.
I created a fresh install from the SDImage, ran the updates, and this is the output from df -h
; a couple of hours later.
tmpfs 50M 37M 14M 73% /var/log
pi@emonpi:/var/log $ ls -la /etc/cron.hourly/logrotate
lrwxrwxrwx 1 root root 46 May 12 10:56 /etc/cron.hourly/logrotate -> /var/www/html/emoncms/scripts/logger/logrotate
Using the command in that file from the command line results inâŚ
pi@emonpi:/var/log $ /usr/sbin/logrotate -v -s /var/log/logrotate/logrotate.status /etc/logrotate.conf 2>&1 | tee /var/log/logrotate/logrotate.log
tee: /var/log/logrotate/logrotate.log: Permission denied
reading config file /etc/logrotate.conf
error: /etc/logrotate.conf:32 duplicate log entry for /var/log/auth.log
Reading state from file: /var/log/logrotate/logrotate.status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Handling 1 logs
rotating pattern: /var/log/*.log /var/log/*/*.log /var/log/syslog /var/log/messages /var/log/btmp /var/log/* 1048576 bytes (1 rotations)
empty log files are not rotated, old logs are removed
switching euid to 0 and egid to 0
error: error switching euid to 0 and egid to 0: Operation not permitted
error: error setting owner of /var/log/logrotate/logrotate.status.tmp to uid 0 and gid 0: Operation not permitted
Nothing is rotated.
Note the output from ls -la /var/log/
drwxr-xr-x 12 root root 560 May 12 10:45 .
drwxr-xr-x 12 root root 4096 Aug 2 2018 ..
drwxr-xr-x 2 root adm 100 Oct 30 2018 apache2
drwxr-xr-x 2 root root 100 May 12 10:45 apt
-rw-r----- 1 root adm 55170 May 12 17:05 auth.log
-rw-r--r-- 1 root root 6590 May 12 10:48 boot.log
-rw------- 1 root utmp 0 Oct 30 2018 btmp
-rw-r----- 1 root adm 18902971 May 12 17:07 daemon.log
-rw-r----- 1 root adm 1177 Oct 30 2018 debug
-rw-r--r-- 1 root root 3565 May 12 10:46 dpkg.log
-rw-rw-rw- 1 root root 30928 May 12 10:56 emoncms.log
drwxr-xr-x 2 emonhub root 60 Oct 30 2018 emonhub
drwxr-xr-x 2 pi root 60 Oct 30 2018 emonpilcd
-rw-r----- 1 root adm 74204 May 12 17:07 kern.log
drwxr-xr-x 2 pi pi 100 May 12 17:06 logrotate
-rw-r----- 1 root adm 54983 May 12 17:07 messages
drwxr-xr-x 2 mosquitto mosquitto 60 Oct 30 2018 mosquitto
-rw-rw-rw- 1 root root 0 Oct 30 2018 mqtt_input.log
drwxr-xr-x 2 mysql adm 60 Oct 30 2018 mysql
-rw-rw-rw- 1 root root 0 Oct 30 2018 mysql.log
-rw-rw-rw- 1 root root 0 Oct 30 2018 ntp_update.log
drwxr-xr-x 2 root root 40 Oct 30 2018 openhab
drwxr-xr-x 2 redis redis 60 Oct 30 2018 redis
-rw-rw-rw- 1 root root 0 Oct 30 2018 service-runner.log
drwxr-xr-x 2 root root 60 Oct 30 2018 supervisor
-rw-r----- 1 root adm 18989391 May 12 17:07 syslog
-rw-r----- 1 root adm 396 Oct 30 2018 user.log
-rw-rw-r-- 1 root utmp 1920 May 12 10:57 wtmp
You can see that the daemon.log
and syslog
are filling up, when I look, the emonhub entries are appearing in both.
I have pointed out on numerous occasions how to stop that happening (your original edits of rsyslog.conf
do not seem to be included) and to improve the rotation before further improvement (Log2Ram) are introduced.
Users will continue to experience issues because of the log folder filling up until this is fixed.