A solução mais simples para o seu caso é provavelmente o log circular, que tem tamanho fixo.
Se você está no Linux, você pode tentar o módulo do kernel emlog
The emlog kernel module implements simple character device driver. The driver acts like a named pipe that has a finite, circular buffer. The size of the buffer is easily configurable. As more data is written into the buffer, the oldest data is discarded. A process that reads from an emlog device will first read the existing buffer, then see new text as it's written, similar to monitoring a log file using "tail -f". (Non-blocking reads are also supported, if a process needs to get the current contents of the log without blocking to wait for new data.)
Em sistemas BSD, consulte CLOG(8)