From Fedora Project Wiki
(Created page with "== Fedora Log Files == In Fedora, a log file is defined as a text file that an application outputs into in the /var/log/ directory. === Log Files on the Filesystem === Pack...")
 
Line 5: Line 5:
=== Log Files on the Filesystem ===
=== Log Files on the Filesystem ===


Packages which generate log files must write out their logfiles in a package-specific (and package owned) directory under /var/log. Unless the software being packaged rotates its own logs, it must also ship a logrotation file to rotate its log file(s).
Packages which generate log files must write out their logfiles in a package-specific (and package owned) directory under /var/log. Unless the software being packaged rotates its own logs, it must also ship a logrotate config file to rotate its log file(s).


=== Logrotate config file ===
=== Logrotate config file ===

Revision as of 16:57, 23 May 2013

Fedora Log Files

In Fedora, a log file is defined as a text file that an application outputs into in the /var/log/ directory.

Log Files on the Filesystem

Packages which generate log files must write out their logfiles in a package-specific (and package owned) directory under /var/log. Unless the software being packaged rotates its own logs, it must also ship a logrotate config file to rotate its log file(s).

Logrotate config file

Logrotate config files should be named in a way that matches the daemon/software which is generating the logs, which is usually (though not always) the same name as the package. When unsure, use "%{name}.conf". These files must be placed in /etc/logrotate.d, and should use standard file permissions (0644) and ownership (root:root).

Example minimal logrotate config file

/var/log/example/*log {
	missingok		# If the log file is missing, go on to the next one without issuing an error message
	notifempty		# Don't do any rotation if the logfile is empty
	compress		# Compress older files with gzip
	delaycompress		# Don't compress yesterdays files
}
Idea.png
Debugging logrotate file
You can debug your logrotate file by running
# logrotate -d -f /etc/logrotate.d/example.conf
from the command line.