borpin
(Brian Orpin)
12 July 2022 12:08
1
Continuing the discussion from Random Hangs of emonPi/emonSD :
There are a variety of logs in the /var/log.old directory, but in the emonhub directory, there are only more recent files. In the emoncms log directory there are loads of entries (see image) - but when uncompressed the files all seem empty.
Can someone with the newer SD Card running (I’m still on emonSD-17Oct19) check and see if their logs are being saved correctly by Log2Ram?
It might be an issue introduced with the latest Image.
@TrystanLea @glyn.hudson
Vster
(Lee)
12 July 2022 12:45
2
Last updated a few months ago -
Seems OK to me.
borpin
(Brian Orpin)
13 July 2022 20:23
3
@Vster Thanks for checking - please post as code between backticks ( 3 on a line before and 3 on a line after - ```
or the “Preformatted </>” format button) rather than images (especially if it gets large).
@rdavies6 - you might want to check as well.
We use a RAMLOG system so /var/log
is mounted in RAM (to reduce SD Card wear).
pi@emonpi:~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 4.0G 2.6G 1.2G 68% /
devtmpfs 484M 0 484M 0% /dev
tmpfs 488M 0 488M 0% /dev/shm
tmpfs 488M 56M 433M 12% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 488M 0 488M 0% /sys/fs/cgroup
tmpfs 1.0M 0 1.0M 0% /var/lib/php/sessions
tmpfs 1.0M 0 1.0M 0% /var/tmp
tmpfs 30M 0 30M 0% /tmp
/dev/mmcblk0p1 253M 52M 202M 21% /boot
/dev/mmcblk0p3 10G 734M 8.8G 8% /var/opt/emoncms
log2ram 50M 6.6M 44M 14% /var/log
tmpfs 98M 0 98M 0% /run/user/1000
To preserver the logs, the /var/log
folder is saved / restored at boot. logrotate
rotates files into a separate folder /var/log.old
.
It took me a while to remind myself, but log2ram
is triggered hourly by cron
(/etc/cron.hourly/log2ram
). This same cron
job triggers logrotate
first.
journalctl -n 50 -u log2ram
will tell you what is happening with log2ram
.
As @rdavies6 says the rotated files are empty, there may be an issue with logrotate
. To investigate you need to look at the logrotate.log
file.
Here’s mine emonSD-24Jul20 :
Filesystem Size Used Avail Use% Mounted on
/dev/root 4.1G 2.7G 1.2G 70% /
devtmpfs 431M 0 431M 0% /dev
tmpfs 463M 0 463M 0% /dev/shm
tmpfs 463M 47M 417M 11% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 463M 0 463M 0% /sys/fs/cgroup
tmpfs 1.0M 0 1.0M 0% /var/lib/php/sessions
tmpfs 1.0M 0 1.0M 0% /var/tmp
tmpfs 30M 0 30M 0% /tmp
/dev/mmcblk0p1 253M 54M 199M 22% /boot
/dev/mmcblk0p3 9.9G 1.6G 7.8G 17% /var/opt/emoncms
log2ram 50M 9.4M 41M 19% /var/log
tmpfs 93M 0 93M 0% /run/user/1000
pi@emonpi:~ $ journalctl -n 50 -u log2ram
-- Logs begin at Tue 2022-07-12 19:52:59 BST, end at Wed 2022-07-13 22:20:42 BST
Jul 13 19:17:03 emonpi log2ram[6000]: logrotate/logrotate.status
Jul 13 19:17:03 emonpi log2ram[6000]: sent 394,770 bytes received 7,276 bytes
Jul 13 19:17:03 emonpi log2ram[6000]: total size is 6,620,785 speedup is 16.47
Jul 13 19:17:03 emonpi systemd[1]: Reloaded Log2Ram.
Jul 13 20:17:01 emonpi systemd[1]: Reloading Log2Ram.
Jul 13 20:17:01 emonpi log2ram[7202]: sending incremental file list
Jul 13 20:17:01 emonpi log2ram[7202]: auth.log
Jul 13 20:17:01 emonpi log2ram[7202]: daemon.log
Jul 13 20:17:01 emonpi log2ram[7202]: log2ram.log
Jul 13 20:17:01 emonpi log2ram[7202]: syslog
Jul 13 20:17:01 emonpi log2ram[7202]: emoncms/wificheck.log
Jul 13 20:17:01 emonpi log2ram[7202]: emonhub/emonhub.log
Jul 13 20:17:01 emonpi log2ram[7202]: logrotate/
Jul 13 20:17:01 emonpi log2ram[7202]: logrotate/logrotate.log
Jul 13 20:17:01 emonpi log2ram[7202]: logrotate/logrotate.status
Jul 13 20:17:01 emonpi log2ram[7202]: sent 3,063,920 bytes received 6,010 bytes
Jul 13 20:17:01 emonpi log2ram[7202]: total size is 9,674,653 speedup is 3.15
Jul 13 20:17:01 emonpi systemd[1]: Reloaded Log2Ram.
Jul 13 21:17:02 emonpi systemd[1]: Reloading Log2Ram.
Jul 13 21:17:02 emonpi log2ram[8417]: sending incremental file list
Jul 13 21:17:02 emonpi log2ram[8417]: ./
Jul 13 21:17:02 emonpi log2ram[8417]: auth.log
There’s about 1.8MB in rotated logs
1 Like
Vster
(Lee)
13 July 2022 23:12
5
@borpin Sorry my bad.
@TrystanLea yes, everything looks fine on my Pi too, including big(!) compressed files for the emonhub.1.gz in the /var/log.old/emonhub/ folder. Gunziping the emonhub.log.X.gz files has valid emonhub type logging in it.
1 Like
borpin
(Brian Orpin)
14 July 2022 05:43
6
Ha, no bother. It is one of those things that can easily slip through and not be noticed until you need the logs!