app-admin/logrotate: Apply Flatcar modifications

This commit is contained in:
Aniruddha Basak 2021-10-28 16:03:42 +00:00 committed by Krzesimir Nowak
parent 40e891505e
commit a1a96c009d
4 changed files with 34 additions and 10 deletions

View File

@ -1,13 +1,19 @@
# Flatcar: This is a modified version of the default config that came
# with Gentoo Linux.
#
# Default logrotate(8) configuration file for Gentoo Linux.
# See "man logrotate" for details.
# rotate log files weekly.
weekly
#weekly
#daily
# keep 4 weeks worth of backlogs.
rotate 4
#rotate 4
# Flatcar: keep only the most recent old log.
rotate 1
# create new (empty) log files after rotating old ones.
create
@ -18,6 +24,8 @@ dateext
# compress rotated log files.
compress
# Flatcar: If a file to rotate is missing, don't log an error.
missingok
notifempty
nomail
noolddir
@ -26,17 +34,14 @@ noolddir
include /etc/logrotate.d
# no packages own wtmp and btmp -- we'll rotate them here.
# must match creation rules in /usr/lib/tmpfiles.d/var.conf
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
size 1M
}
/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
size 1M
}
# system-specific logs may also be configured here.

View File

@ -0,0 +1,5 @@
[Unit]
Description=Rotate and Compress System Logs
[Service]
ExecStart=/usr/bin/logrotate /usr/share/logrotate/logrotate.conf

View File

@ -1 +1,2 @@
d /var/lib/misc
d /etc/logrotate.d - - - - -

View File

@ -64,12 +64,25 @@ src_install() {
doman logrotate.8
dodoc ChangeLog.md
insinto /etc
# Flatcar: Put our config under /usr. We will point logrotate
# to use this configuration in the systemd unit we install
# below. User can always customize logrotate configuration by
# using drop-ins to point to a different path or by adding
# logrotate config files to /etc/logrotate.d.
insinto /usr/share/logrotate
doins "${FILESDIR}"/logrotate.conf
use cron && install_cron_file
systemd_dounit examples/logrotate.{service,timer}
# Flatcar: Install our own systemd service file and enable it
# by default.
#
# TODO: We probably should just patch the example logrotate
# service unit, as it has a bunch of hardening and performance
# tuning stuff done.
systemd_dounit examples/logrotate.timer
systemd_dounit "${FILESDIR}"/logrotate.service
systemd_enable_service multi-user.target logrotate.timer
newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf
keepdir /etc/logrotate.d