From Fedora Project Wiki
Line 5: Line 5:


Packages with log files must reside in their own directory under /var/log and must be named /var/log/$package_name  
Packages with log files must reside in their own directory under /var/log and must be named /var/log/$package_name  
Each log file in that directory must end with .log filename.
Each log file in that directory must end with .log filename.



Revision as of 11:31, 23 February 2012

Fedora Log Files

This document describes the guidelines for log files, for use and inclusion in Fedora packages.

Log Files on the filesystem

Packages with log files must reside in their own directory under /var/log and must be named /var/log/$package_name

Each log file in that directory must end with .log filename.

Each package that ships log files must also ship a logrotation file that rotates the log file(s).

Log Files Packaging

Name:
.....
Source1: %{name}.logrotate
Requires: logrotate

%install
...
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
%{__install} -p -D -m 0700 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}.conf

%files
...
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}.conf
%dir %attr(0700,root,root) %{_localstatedir}/log/%{name}