shepherd services with #:log-file overwrite their log file

  • Done
  • quality assurance status badge
Details
3 participants
  • Andreas Enge
  • Danny Milosavljevic
  • Ludovic Courtès
Owner
unassigned
Submitted by
Andreas Enge
Severity
normal
A
A
Andreas Enge wrote on 28 Feb 2018 15:50
Cuirass service does not rotate its logs
(address . bug-guix@gnu.org)
20180228145039.GA4589@jurong
Hello,

while testing the cuirass service on bayfront, I see the following:

$ ll /var/log/c*
-rw-r--r-- 1 root root 2003521 Feb 28 15:38 /var/log/cuirass.log

I am sure this 2MB file was about 14MB big this morning, and indeed
any information dating from before this morning, when I rebooted the
machine and thus restarted the service, has gone.

Notice also that there are no numbered files cuirass.log.1 etc..

Andreas
D
D
Danny Milosavljevic wrote on 28 Feb 2018 17:48
(name . Andreas Enge)(address . andreas@enge.fr)(address . 30649@debbugs.gnu.org)
20180228174823.5fec105f@scratchpost.org
Hi Andreas,

On Wed, 28 Feb 2018 15:50:39 +0100
Andreas Enge <andreas@enge.fr> wrote:

Toggle quote (9 lines)
> $ ll /var/log/c*
> -rw-r--r-- 1 root root 2003521 Feb 28 15:38 /var/log/cuirass.log
>
> I am sure this 2MB file was about 14MB big this morning, and indeed
> any information dating from before this morning, when I rebooted the
> machine and thus restarted the service, has gone.
>
> Notice also that there are no numbered files cuirass.log.1 etc..

The simplest and best way to fix that is to make cuirass use syslog.

Not every program has to have its own private logging implementation,
log rotator, log filterting, log rate limiter, kitchen sink etc.

src/cuirass/logging.scm is prepared somewhat for this possiblity[2], but it
doesn't yet log to syslog.

There are guile syslog bindings[1] and we should use them and then apply a
two-line patch to src/cuirass/logging.scm .

[2] Replace current-logging-procedure
L
L
Ludovic Courtès wrote on 1 Mar 2018 17:35
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87371j69fm.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (25 lines)
> Hi Andreas,
>
> On Wed, 28 Feb 2018 15:50:39 +0100
> Andreas Enge <andreas@enge.fr> wrote:
>
>> $ ll /var/log/c*
>> -rw-r--r-- 1 root root 2003521 Feb 28 15:38 /var/log/cuirass.log
>>
>> I am sure this 2MB file was about 14MB big this morning, and indeed
>> any information dating from before this morning, when I rebooted the
>> machine and thus restarted the service, has gone.
>>
>> Notice also that there are no numbered files cuirass.log.1 etc..
>
> The simplest and best way to fix that is to make cuirass use syslog.
>
> Not every program has to have its own private logging implementation,
> log rotator, log filterting, log rate limiter, kitchen sink etc.
>
> src/cuirass/logging.scm is prepared somewhat for this possiblity[2], but it
> doesn't yet log to syslog.
>
> There are guile syslog bindings[1] and we should use them and then apply a
> two-line patch to src/cuirass/logging.scm .

Indeed. I wonder why we don’t have a Gamma package yet!

Ludo’.
L
L
Ludovic Courtès wrote on 1 Mar 2018 17:35
(name . Andreas Enge)(address . andreas@enge.fr)(address . 30649@debbugs.gnu.org)
87y3jb4utx.fsf@gnu.org
Andreas Enge <andreas@enge.fr> skribis:

Toggle quote (5 lines)
> while testing the cuirass service on bayfront, I see the following:
>
> $ ll /var/log/c*
> -rw-r--r-- 1 root root 2003521 Feb 28 15:38 /var/log/cuirass.log

The cuirass service in GuixSD explicitly extends rottlog so that this
file is rotated on a weekly basis. Perhaps you just need to wait a
little longer?

Ludo’.
L
L
Ludovic Courtès wrote on 1 Mar 2018 17:36
(name . Andreas Enge)(address . andreas@enge.fr)(address . 30649@debbugs.gnu.org)
87tvtz4usi.fsf@gnu.org
ludo@gnu.org (Ludovic Courtès) skribis:

Toggle quote (11 lines)
> Andreas Enge <andreas@enge.fr> skribis:
>
>> while testing the cuirass service on bayfront, I see the following:
>>
>> $ ll /var/log/c*
>> -rw-r--r-- 1 root root 2003521 Feb 28 15:38 /var/log/cuirass.log
>
> The cuirass service in GuixSD explicitly extends rottlog so that this
> file is rotated on a weekly basis. Perhaps you just need to wait a
> little longer?

I confirm that rotation works as expected on berlin.

Ludo’.
A
A
Andreas Enge wrote on 1 Mar 2018 17:43
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 30649@debbugs.gnu.org)
20180301164310.GA13951@jurong
On Thu, Mar 01, 2018 at 05:35:54PM +0100, Ludovic Courtï¿œs wrote:
Toggle quote (4 lines)
> The cuirass service in GuixSD explicitly extends rottlog so that this
> file is rotated on a weekly basis. Perhaps you just need to wait a
> little longer?

The problem is not that the file grows too large.

The problem was that after rebooting the server, the file was *replaced*
with newly written content. Maybe the problem is not rotation, but opening
a file in "write" instead of "append" mode...

Andreas
L
L
Ludovic Courtès wrote on 1 Mar 2018 22:39
control message for bug #30649
(address . control@debbugs.gnu.org)
874llz4grw.fsf@gnu.org
retitle 30649 shepherd services with #:log-file overwrite their log file
L
L
Ludovic Courtès wrote on 2 Mar 2018 00:47
Re: bug#30649: Cuirass service does not rotate its logs
(name . Andreas Enge)(address . andreas@enge.fr)(address . 30649-done@debbugs.gnu.org)
87606ehbtq.fsf@gnu.org
Andreas Enge <andreas@enge.fr> skribis:

Toggle quote (11 lines)
> On Thu, Mar 01, 2018 at 05:35:54PM +0100, Ludovic Courtès wrote:
>> The cuirass service in GuixSD explicitly extends rottlog so that this
>> file is rotated on a weekly basis. Perhaps you just need to wait a
>> little longer?
>
> The problem is not that the file grows too large.
>
> The problem was that after rebooting the server, the file was *replaced*
> with newly written content. Maybe the problem is not rotation, but opening
> a file in "write" instead of "append" mode...

Oh indeed, that’s a different thing.

This is fixed by Shepherd commit
7b4c88bac70f0bad82ef70fd5b682a49bc227478, thanks!

Ludo’.
Closed
?