Log Files
Understand how to manage log files to prevent system instability by avoiding full filesystems and excessive memory use. Explore log file rotation techniques, centralizing logs for compliance, and controlling in-memory caches to maintain system health and reduce manual interventions.
The growth of log files
One log file is like one wood chip—not very valuable. However, collect tons of wood chips and it becomes a saleable commodity. Likewise, if we collect enough log files, we can discover value.
Left unchecked, however, log files on individual machines are a risk. When log files grow without bound, they’ll eventually fill up their filesystem. Whether that’s a volume set aside for logs, the root disk, or the application installation directory, it means trouble. When log files fill up the filesystem, they jeopardize stability. That’s because of the different negative effects that can occur when the filesystem is full.
Filesystem space
On a UNIX system, the last 5–10 percent (depending on the configuration of the filesystem) of space is reserved for root. That means an application will start having I/O errors when the filesystem is 90 or 95 percent full. Of course, if the application is running as root, then it can consume the very last byte of space. On a Windows system, an application can always use the very last byte. In either case, the operating system will report errors back to the application.
What happens next is anyone’s guess. In the best-case scenario, the logging filesystem is separate from any critical data storage (such as transactions), and the application code protects ...