Logfile purging

I’ve managed twice to have the Pixhawk not bootable. Both times because the memory card was full. It isn’t very obvious what causing the problem and takes some time to find-out as it shouldn’t happen too often.
Would it be hard to add some logfile purging at a certain level? Currently you cannot use the last log as it is corrupt (not fully written)
To be able to use the log for a more commercial use there must be some solution for this as the system refuse to work when the SD-card is full