Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 646032 - www-servers/apache: logrotate doesn't work with systemd
Summary: www-servers/apache: logrotate doesn't work with systemd
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Lars Wendler (Polynomial-C) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-29 08:47 UTC by Pacho Ramos
Modified: 2021-02-12 14:32 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
0001-2.4-scripts-apache2-logrotate-handle-systemd.patch (0001-2.4-scripts-apache2-logrotate-handle-systemd.patch,1.02 KB, patch)
2021-02-12 14:12 UTC, Pacho Ramos
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2018-01-29 08:47:38 UTC
While running apache I noticed that, from time to time, logs were emptied and nothing more was written on them anymore.

This is caused by logrotate file, it doesn't take into account systemd and, then, it causes this mess

It should probably be modified to something like this:

/var/log/apache2/*log {
  missingok
  notifempty
  sharedscripts
  postrotate
  if test -d /run/systemd/system ; then
    systemctl reload apache2.service > /dev/null 2>&1 || true
  else
    /etc/init.d/apache2 reload > /dev/null 2>&1 || true
  fi
  endscript
}

Thanks
Comment 1 Alexander Tsoy 2018-02-13 09:03:24 UTC
Related problem:

$ cat /usr/sbin/apache2ctl
#!/bin/sh
exec /etc/init.d/apache2 "$@"
Comment 2 Pacho Ramos gentoo-dev 2018-02-15 11:18:39 UTC
What is using that helper?
Comment 3 Pacho Ramos gentoo-dev 2018-04-02 11:41:58 UTC
Well, at the end is providing this:
/var/log/apache2/*log {
  missingok
  notifempty
  sharedscripts
  postrotate
  if test -d /run/systemd/system ; then
    systemctl reload apache2.service > /dev/null 2>&1 || true
  else
    /etc/init.d/apache2 reload > /dev/null 2>&1 || true
  fi
  endscript
}


In gentoo-patches tarball (under scripts subdir)
Comment 4 Pacho Ramos gentoo-dev 2021-02-12 09:19:42 UTC
this is still needed... could it be changed please?

Thanks
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2021-02-12 09:52:44 UTC
If you could provide a git-formatted patch against

  https://gitweb.gentoo.org/proj/apache.git/

I'd appreciate that very much. I still don't use systemd on any Gentoo instance where I run apache so I cannot test it reliably.
Comment 6 Pacho Ramos gentoo-dev 2021-02-12 14:12:59 UTC
Created attachment 686469 [details, diff]
0001-2.4-scripts-apache2-logrotate-handle-systemd.patch

Let's see if I created it correctly... I am not used to git format-patch :/

Thanks
Comment 7 Larry the Git Cow gentoo-dev 2021-02-12 14:28:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/apache.git/commit/?id=64371485b30887df6097de53f106803ecc746dae

commit 64371485b30887df6097de53f106803ecc746dae
Author:     Pacho Ramos <pachoramos@gmail.com>
AuthorDate: 2021-02-12 14:09:08 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2021-02-12 14:26:22 +0000

    2.4/scripts/apache2-logrotate: handle systemd
    
    Bug: https://bugs.gentoo.org/646032
    Signed-off-by: Pacho Ramos <pacho@gentoo.org>
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 2.4/scripts/apache2-logrotate | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
Comment 8 Larry the Git Cow gentoo-dev 2021-02-12 14:32:26 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2107343b4a5852b387f0b0dc61a435194f60fd1

commit d2107343b4a5852b387f0b0dc61a435194f60fd1
Author:     Lars Wendler <polynomial-c@gentoo.org>
AuthorDate: 2021-02-12 14:30:26 +0000
Commit:     Lars Wendler <polynomial-c@gentoo.org>
CommitDate: 2021-02-12 14:32:23 +0000

    www-servers/apache: Revbump to fix logrotate on systemd
    
    Thanks-to: Pacho Ramos <pacho@gentoo.org>
    Closes: https://bugs.gentoo.org/646032
    Package-Manager: Portage-3.0.14, Repoman-3.0.2
    Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>

 www-servers/apache/Manifest                |   1 +
 www-servers/apache/apache-2.4.46-r6.ebuild | 257 +++++++++++++++++++++++++++++
 2 files changed, 258 insertions(+)