I’ve been spending a bit of time lately going through my private source code repositories and tidying up things for public release.
A while ago I had a customer who required their FreeRadius traffic accounting logs to be collected from a few servers and saved onto a mounted network drive. It’s a simple enough problem, however there’s a few requirements that make it slightly trickier than it sounds:
- Extremely important that log files weren’t lost or corrupted in any circumstance.
- The archive location was a mounted network drive, this means no guarantee that the filesystem would always be mounted and writable.
- The rotated files need to be named with the server hostname so that files from multiple servers could be collated in a single location without clashing.
- Regular frequent execution period, eg every 5 or 10 minutes.
The solution I wrote was “Radius Rapid Rotate” (or R3 since I’m a lazy typist). This utility rotates FreeRadius log files in a manner which meets all the above requirements.
It would have been possible to write this all into an existing application, such as logrotate, however logrotate isn’t intended for such frequent execution and won’t do log rotation onto a network mount in a manner that will handle a dodgy network mount gracefully.
Whilst this application is FreeRadius focused, it would be easy to port to use for other purposes if suitable.
You can read more about R3 and download it’s source code here.