Logging
Dave Higton (1515) 3526 posts |
SysLog is very useful, but I would like to log a fair amount of stuff on a Raspberry Pi that’s doing pretty much an embedded job – it’s headless and must be completely reliable. Since it doesn’t have a hard drive, all it has is a micro SD card. Clearly I don’t want to wear that out, so I would like to be able to log to something else. I have a NAS with two spinning rust drives, which I try to remember to replace before they reach the end of the reliable part of their lives. So, if there were something that does a job like SysLog but to a remote medium, I’d have what I want. Is there such a thing? SysLog’s Help doesn’t mention remote logging, so I have to assume that it can’t do what I want. |
Martin Avison (27) 1494 posts |
If you must have reliability, one question is how reliable is any link to the remote drive, and the remote drive itself? Would a local USB drive be more reliable? What about power failures? Reporter logs to memory, but can automatically save it to a file (which could be remote) either automatically when memory is full, or from a command which could could be issued at intervals from another program. However, the remote logs would only be updated at those intervals, so log data could be lost if the Pi or its remote access failed. PM me if you want to discuss further. Some NAS have Syslog servers (eg Synology), but whether the RISC OS version can log to them I do not know. Note that Reporter can also write to Syslog. |
Dave Higton (1515) 3526 posts |
It is much more important that the logged system continue to operate, than that the logging process works. Everything must start up correctly after a power failure. We’ve had several in the ~10 months that we’ve lived in this house, with causes shared between Electricity North West, our own breakers tripping unexpectedly, and work on the house wiring necessitating mains switch-off. A local USB drive seems to me to cause as many problems as it solves. If it fails, the local filing system is likely to kick up an error that will stop the system. I’ve certainly had a USB flash drive fail (become read-only), and I would rather not add the cost and lifetime issue of a rotating drive – especially when I have two perfectly good ones on the LAN whose finite lifetimes are already accounted for. |
Chris Johnson (125) 825 posts |
There is a module syslogd that allows you to log to a remote machine. The help info in it says SysLogD 0.03 (22 Jan 2003) © 1999-2003 John Tytgat / BASS I used to use it to log stuff from other machines to an Iyonix. Not sure if it would suit you, or even if it works on ARMv7 hardware. |
Rick Murray (539) 13840 posts |
Sounds like what you need is not a better sort of media, but something that can override power disturbances entirely. Consider something like: https://www.banggood.com/Geekworm-UPS-HAT-Board-2500mAh-Lithium-Battery-For-Raspberry-Pi-3-Model-B-Pi-2B-B-A-p-1105260.html [this isn’t a recommendation, I don’t have this…yet.] |
Colin (478) 2433 posts |
This is the case with any filing system method isn’t it? ShareFS and LanManFS can both be prone to blocking failure modes – try opening a lanman share directory after the share has disappeared. Any logging would have to cope with the remote end disappearing and not block. The filing system can block on closing if there is unsent data in the buffers, it is waiting for a handshake and the remote end has disappeared. One solution, if the nas has ftp, may be to ftp to the server and just implement file storing – you can append to existing files. That way with non blocking sockets you can fail in a non blocking way and build in resiliance like trying to open a connection in a non blocking way until the remote end appears again after a write has failed. |
Martin Avison (27) 1494 posts |
I have just tried using With the disc dismounted, the Reporter message was Obviously there are many other scenarios which would need testing, but I did try to trap and report all save errors in the same way. Nothing is written to the local disc.
That module listens for incoming syslog messages and writes them to (a local) !SysLog. I think Dave would need a module that acts like !SysLog but sends syslog messages to another machine. |
Steve Pampling (1551) 8170 posts |
With a mapped drive then possibly SysLogDev Edit: |
Dave Higton (1515) 3526 posts |
Thank you for the suggestion of a UPS, but it ignores the original stated aim of preventing the SD card from wearing out. I didn’t specifically state in my original posting that settings can be changed via a web interface, which means that it must be possible to write to the SD card. These changes are much less frequent than the logging. The context, for those who haven’t already guessed, is my new central heating control system, which is much more powerful than the previous one. I’d like to log quite a lot of information over a long period in order to get the best out of it. My simplest option may be to put the log directory in RAM disc, and simply copy the log files over to somewhere else from time to time. It will require some splicing together of files to get a longer log, but that’s a tractable problem. |