Raspberry Pi 2 Logging

Here’s a thing… if you’re using a Raspberry Pi as some kind of central controller for long-term home control or other data logging application you will no doubt be aware of the potential issues with FLASH memory. The Pi will let you use Linux and log stuff and shove information into databases but is perhaps not quite as aware of the limits of it’s own Flash memory as it should be? Flash only lasts so many write/erase cycles.

With that in mind I was rather pleased, using as I am the latest RASPBIAN, when I turned on email recently on the Pi, to receive daily emails from the unit along the lines of…

apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName
Restarting ramlog = saving logs to hdd: .

I’m not wildly happy about a range of messages I’ve never been able to stop about fully qualified domain names – but that’s just a warning.. however the important thing here – is the logging. This is NOT something I’ve done – and hence I can only assume it is built into the latest setup of Debian for Pi (at least the Pi2)  – clearly, logs are being saved up in memory and dumped to FLASH once a day – which will help immensely to reduce the amount of writing to FLASH – now if I could just figure out how to make it do that with MYSQL (yes, I do use an uninterruptable power supply) I could ignore the desire to strap a hard disk to my Pi (I’ve already done that with the one I’ve left running in Spain).

If anyone has been through all of this AND has RAM buffering of all MYSQL activity, do enlighten us in here.


p.s. Funny old thing the Pi…  so this morning the email turned up with no reference to domain names!!

Restarting ramlog = saving logs to hdd: .


12 thoughts on “Raspberry Pi 2 Logging

  1. Hi Peter, I share your concerns re flash longevity but SD cards essentially use the same memory as mobile phones. I’ve had mine for years & it’s still working fine.
    I’m a little less confident about the rPi – I have 4 of these and couldn’t describe any of them as ‘ultra reliable’
    Until recently I ran my MQTT broker on a separate box – a TP Link 703 running openwrt. This IS reliable, sadly it doesn’t have the balls for node-red so I’m using rPis now.
    Reliability isn’t a huge concern for me thankfully as I do this stuff for teaching students.

  2. Hi

    The experience I have of long term logging of data is that the Pi SD card WILL fail. This is an experience shared by many users of emoncms (http://openenergymonitor.org/emon/) to the extent that the software has been modified for minimum SD write, A lot of users including me have added hard disks to the pi and others are using the pi as a server and hub but saving the data on a different PC even in some cases saving the data in 2 places. The ability to do this has been added to the software partly because of the SD failures experienced by users.



  3. I’m by no means an expert on SD cards, but it appears that there is a big difference between cheap and pricey ones. I’ve had failures in a number of low-cost cards, recently two from Dane-Elec (a brand that is sold by Target stores here in the US, and is therefore very easy to get when you suddenly need a card!) I’ve switched to using SanDisk Extreme and Ultra Pro cards, and so far none of them have failed. My problems haven’t been with logging, but I have a Pi running a 3D scanner and it writes very large files every time it makes a scan. Arguably it would be better off with a hard drive, and it will probably get one eventually…

  4. Yes, i’m also concerned about SD failure… I’m thinking about those raspberry-like boards with SATA and plug in a small SDD disk.

    A lot of options nowadays.. cubieboard, banana pi, orange pi…

    Anyone has experience using sata disks with these boards?

    1. 29.5.2015

      You can use a USB Disc drive on the Pi – I have had no problems with that.
      BUT yu can boot from the SD then all further processing is done on the USB drive as the root. This is one way:
      This would solve the SD problem.

      For the next version of Raspberry Pi I’d like an estata connection with the possibility of booting from the drive and a decent power supply connection instead of the usb power socket.

      QUESTION ABOUT SD: Sometimes I have the problem that format a used SD, transfer the
      image file to the SD – it will not boot. However the SD can re read by Windows ( I can delete
      and add files) but re-formatting and copying the image data to the card doesn’t solve the problem. It still will not boot inspite of formating “quick” and “full overwrite”.
      I must poit out that the SD is usable in my Camera and TV.
      What mysteries are involved here?



      1. If I am right – USB drives (ie the normal cheap USB sticks) have no better lifespan than the microSD in the Pi.

        1. @admin
          “If I am right – USB drives (ie the normal cheap USB sticks) have no better lifespan than the microSD in the Pi.”

          The USB Drive can be a HDD or a high quality USB STick. I have used both but have the USB HDD 1TB in cueently in use. The huge disavantage is that you need mains to power the drive or perhaps a 12V battery backup.

    2. I’ve not – but I see no reason why they should not work – I’m using a normal hard drive- works a treat…. and so solid state drives have mechanisms to reduce wear otherwise they’d be useless for things like databases. It really is time the industry got it’s finger out and came up with something better.

  5. Slightly off-topic but, I wanted an elegant way to get notifications when something needs my attention. Email, SMS, Whatsapp all have serious restrictions, overhead or whatever.
    I stumbled onto ‘PushBullet’, a multi platform messaging system. It has send and receive nodes for node-red, Android, iOS, Firefox and IE plugins and is lightweight and easy to set up. By sending a message to your own address it pops up nicely on all your devices. Replies can be sent too. Can’t find a downside!

    1. Yes I think Pushbullet is neat too – have it on the browser and on my phone and Node-Red is able to send out messages… just need time to investigate it’s features more fully. DEAD easy to use with Node-Red.

  6. So by now, most people will have figured out to use RAMLOG (though I have 2 of them and only one of them is sending me emails for some reason) – but has anyone figured out how to have MYSQL work entirely in RAM and update the flash once a day and if so do they have instructions for the Pi? I am reliably using those cheap usb chargers (not all work) as an uninterruptable power supply. I can happily unplug and re-plug the usb into power all day and the PI will continue to work reliably.

Comments are closed.