User:Spot/Packaging/LogFiles

From FedoraProject

< User:Spot(Difference between revisions)
Jump to: navigation, search
 
Line 6: Line 6:
  
 
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 %{_sysconfdir}/logrotate.d, and should use standard file permissions (0644) and ownership (root:root).
 
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 %{_sysconfdir}/logrotate.d, and should use standard file permissions (0644) and ownership (root:root).
 +
 +
Since these are config files, they must be marked as %config(noreplace) in the %files list.
  
 
==== Example minimal logrotate config file ====
 
==== Example minimal logrotate config file ====

Latest revision as of 17:08, 23 May 2013

[edit] Fedora Log Files

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

[edit] 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 %{_sysconfdir}/logrotate.d, and should use standard file permissions (0644) and ownership (root:root).

Since these are config files, they must be marked as %config(noreplace) in the %files list.

[edit] 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
}