A systems administrator is alerted that a critical Linux application server is running low on disk space on the root partition. Upon investigation, the administrator finds that a single log file, /var/log/app/application.log, has grown to over 100 GB. The administrator needs to implement a long-term, automated solution to prevent this from recurring while preserving recent log data for troubleshooting. Which of the following is the MOST effective solution?
Modify the application's configuration to send all log output to /dev/null.
Write a cron job that runs a script nightly to delete the application.log file.
Configure a log rotation utility to schedule the regular archiving and compression of the log file.
Provision a larger disk for the server and move the /var/log directory to the new partition.
The correct answer is to configure a log rotation utility. Log rotation is the standard and most effective method for managing log files that grow over time. This process automatically renames, compresses, moves, and eventually deletes old log files based on a defined schedule or size threshold. This prevents any single file from consuming all available disk space while preserving recent logs for analysis and compliance. Increasing the disk size is only a temporary fix and does not address the root cause of the uncontrolled log growth. Writing a script to simply delete the file would result in the loss of potentially critical troubleshooting data. Disabling logging entirely by redirecting output to /dev/null would solve the space issue but is a severe anti-pattern that would make future troubleshooting and security auditing impossible.