diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.conf b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.conf index d25e023858..0b1d0b9265 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.conf +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.conf @@ -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. diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.service b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.service new file mode 100644 index 0000000000..92dcd0368e --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.service @@ -0,0 +1,5 @@ +[Unit] +Description=Rotate and Compress System Logs + +[Service] +ExecStart=/usr/bin/logrotate /usr/share/logrotate/logrotate.conf diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.tmpfiles b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.tmpfiles index dfb4ab66c1..e0c2f7c293 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.tmpfiles +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/files/logrotate.tmpfiles @@ -1 +1,2 @@ d /var/lib/misc +d /etc/logrotate.d - - - - - diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/logrotate-3.20.1-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/logrotate-3.20.1-r1.ebuild index 868b758df6..59e516b607 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/logrotate-3.20.1-r1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/logrotate/logrotate-3.20.1-r1.ebuild @@ -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