Add logrotate file

This commit is contained in:
Robert-André Mauchin 2022-01-16 02:02:42 +01:00
parent 791672b2e3
commit 676d8f81a6
2 changed files with 17 additions and 3 deletions

View File

@ -30,6 +30,7 @@ Source2: %{shortname}.sysusers
Source3: %{shortname}.conf
Source4: %{shortname}.yml
Source5: README.templates
Source6: %{shortname}.logrotate
# Replace defaults paths for config files
Patch0: defaults-paths.patch
@ -87,6 +88,8 @@ BuildRequires: golang(gopkg.in/yaml.v2)
BuildRequires: golang(github.com/kylelemons/godebug/pretty)
%endif
%sysusers_requires_compat
%description
%{common_description}
@ -119,9 +122,10 @@ install -Dpm0644 %{S:4} %{buildroot}%{_sysconfdir}/prometheus/alertmanager.yml
install -Dpm0644 %{S:5} %{buildroot}%{_sysconfdir}/prometheus/alertmanager_templates/README.templates
mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus/alertmanager
install -Dm0644 %{S:1} %{buildroot}%{_unitdir}/%{shortname}.service
install -Dm0644 %{S:2} %{buildroot}%{_sysusersdir}/%{shortname}.conf
install -Dm0644 %{S:3} %{buildroot}%{_sysconfdir}/default/%{shortname}
install -Dpm0644 %{S:1} %{buildroot}%{_unitdir}/%{shortname}.service
install -Dpm0644 %{S:2} %{buildroot}%{_sysusersdir}/%{shortname}.conf
install -Dpm0644 %{S:3} %{buildroot}%{_sysconfdir}/default/%{shortname}
install -Dpm0644 %{S:6} %{buildroot}%{_sysconfdir}/logrotate.d/%{shortname}
install -Dpm0644 template/default.tmpl %{buildroot}/%{_datadir}/prometheus/alertmanager/template/default.tmpl
# Build man pages.
@ -163,6 +167,7 @@ sed -i 's/\.\/amtool/amtool/' %{buildroot}/%{_mandir}/man1/amtool.1
%{_mandir}/man1/amtool.1*
%dir %{_sysconfdir}/prometheus
%config(noreplace) %{_sysconfdir}/prometheus/alertmanager.yml
%config(noreplace) %{_sysconfdir}/logrotate.d/%{shortname}
%{_sysconfdir}/prometheus/alertmanager_templates
%config(noreplace) %{_sysconfdir}/default/%{shortname}
%dir %attr(0755,prometheus,prometheus) %{_sharedstatedir}/prometheus

View File

@ -0,0 +1,9 @@
/var/log/prometheus/prometheus-alertmanager.log {
weekly
rotate 10
copytruncate
compress
delaycompress
notifempty
missingok
}