all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62163: Suppress logging shepherd evaluation in mcron.log
@ 2023-03-13 15:59 Bruno Victal
  2023-03-24 12:22 ` Maxim Cournoyer
  0 siblings, 1 reply; 14+ messages in thread
From: Bruno Victal @ 2023-03-13 15:59 UTC (permalink / raw)
  To: 62163; +Cc: mirai

Upon mcron job completion, /var/log/mcron.log is spammed with:
“shepherd: Evaluating user expression (and (defined? (quote transient?)) (map (# ?) ?))”

These shepherd lines should be suppressible.


/var/log/mcron.log snippet:

--8<---------------cut here---------------start------------->8---
2023-03-13 16:52:00 243 my-heartbeat-job job: running...
2023-03-13 16:52:00 243 my-heartbeat-job job: Healthcheck: OK
2023-03-13 16:52:00 243 my-heartbeat-job job: shepherd: Evaluating user expression (and (defined? (quote transient?)) (map (# ?) ?)).
2023-03-13 16:52:00 243 my-heartbeat-job job: completed in 0.087s
--8<---------------cut here---------------end--------------->8---




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-13 15:59 bug#62163: Suppress logging shepherd evaluation in mcron.log Bruno Victal
@ 2023-03-24 12:22 ` Maxim Cournoyer
  2023-03-28 16:25   ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Maxim Cournoyer @ 2023-03-24 12:22 UTC (permalink / raw)
  To: Bruno Victal; +Cc: Ludovic Courtès, 62163

Hi,

Bruno Victal <mirai@makinata.eu> writes:

> Upon mcron job completion, /var/log/mcron.log is spammed with:
> “shepherd: Evaluating user expression (and (defined? (quote transient?)) (map (# ?) ?))”
>
> These shepherd lines should be suppressible.
>
>
> /var/log/mcron.log snippet:
>
> 2023-03-13 16:52:00 243 my-heartbeat-job job: running...
> 2023-03-13 16:52:00 243 my-heartbeat-job job: Healthcheck: OK
> 2023-03-13 16:52:00 243 my-heartbeat-job job: shepherd: Evaluating user expression (and (defined? (quote transient?)) (map (# ?) ?)).
> 2023-03-13 16:52:00 243 my-heartbeat-job job: completed in 0.087s
>

I think this was already fixed in Shepherd on its master branch.  Ludo,
could you please confirm?

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-24 12:22 ` Maxim Cournoyer
@ 2023-03-28 16:25   ` Ludovic Courtès
  2023-03-28 16:32     ` Bruno Victal
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2023-03-28 16:25 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 62163, Bruno Victal

Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> Bruno Victal <mirai@makinata.eu> writes:
>
>> Upon mcron job completion, /var/log/mcron.log is spammed with:
>> “shepherd: Evaluating user expression (and (defined? (quote transient?)) (map (# ?) ?))”
>>
>> These shepherd lines should be suppressible.
>>
>>
>> /var/log/mcron.log snippet:
>>
>> 2023-03-13 16:52:00 243 my-heartbeat-job job: running...
>> 2023-03-13 16:52:00 243 my-heartbeat-job job: Healthcheck: OK
>> 2023-03-13 16:52:00 243 my-heartbeat-job job: shepherd: Evaluating user expression (and (defined? (quote transient?)) (map (# ?) ?)).
>> 2023-03-13 16:52:00 243 my-heartbeat-job job: completed in 0.087s
>>
>
> I think this was already fixed in Shepherd on its master branch.  Ludo,
> could you please confirm?

Nope. :-)  What is ‘my-heartbeat-job’ doing?

The “Evaluating…” message occurs when using the ‘eval’ action of the
‘root’ service, as in “herd eval root '(+ 2 2)'”.

Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-28 16:25   ` Ludovic Courtès
@ 2023-03-28 16:32     ` Bruno Victal
  2023-03-30 10:22       ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Bruno Victal @ 2023-03-28 16:32 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62163, Maxim Cournoyer

Hi Ludo’,

On 2023-03-28 17:25, Ludovic Courtès wrote:
> 
> Nope. :-)  What is ‘my-heartbeat-job’ doing?

It queries shepherd to see if a service is running and sends a restart if required.
It looks like this:  (#$task is what will perform the actual checks)

--8<---------------cut here---------------start------------->8---
(define* (heartbeat-supervisor #:key (name #f) service task
                               #:allow-other-keys)
  ;; Query service status and restart if needed.
  (program-file
   (format #f "~@[~a-~]heartbeat-supervisor.scm" name)
   (with-imported-modules (source-module-closure
                           '((gnu services herd)))
     #~(begin
         (use-modules (gnu services herd)
                      (srfi srfi-1))

         (define (is-service-running? sym)
           (lambda (x)
             (and (live-service-running x)
                  (memq sym (live-service-provision x)))))

         (let ((running? (not (null?
                               (any (is-service-running? '#$service)
                                    (current-services))))))
           (when running?
             (case (status:exit-val (system* #$task))
               ((0) #t)
               ((125)
                (format #t "Heartbeat worker error~%"))
               (else
                (format #t "Issuing restart for service '~a'~%" '#$service)
                (restart-service '#$service)))))

         (exit)))))
--8<---------------cut here---------------end--------------->8---


This message also shows up if you're using certbot-service-type,
so it's not specific to the snippet above.


Cheers,
Bruno




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-28 16:32     ` Bruno Victal
@ 2023-03-30 10:22       ` Ludovic Courtès
  2023-03-30 11:21         ` Bruno Victal
  2023-03-31 11:52         ` Bruno Victal
  0 siblings, 2 replies; 14+ messages in thread
From: Ludovic Courtès @ 2023-03-30 10:22 UTC (permalink / raw)
  To: Bruno Victal; +Cc: 62163, Maxim Cournoyer

Hi,

Bruno Victal <mirai@makinata.eu> skribis:

> On 2023-03-28 17:25, Ludovic Courtès wrote:
>> 
>> Nope. :-)  What is ‘my-heartbeat-job’ doing?
>
> It queries shepherd to see if a service is running and sends a restart if required.

Isn’t that what #:respawn? #t is supposed to do?  :-)

If you find that #:respawn? doesn’t work, then we should fix it.

> (define* (heartbeat-supervisor #:key (name #f) service task
>                                #:allow-other-keys)
>   ;; Query service status and restart if needed.
>   (program-file
>    (format #f "~@[~a-~]heartbeat-supervisor.scm" name)
>    (with-imported-modules (source-module-closure
>                            '((gnu services herd)))
>      #~(begin
>          (use-modules (gnu services herd)
>                       (srfi srfi-1))
>
>          (define (is-service-running? sym)
>            (lambda (x)
>              (and (live-service-running x)
>                   (memq sym (live-service-provision x)))))
>
>          (let ((running? (not (null?
>                                (any (is-service-running? '#$service)
>                                     (current-services))))))

You can send messages to the bitbucket with:

  (parameterize ((shepherd-message-port (%make-void-port "w0")))
    …)

HTH,
Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-30 10:22       ` Ludovic Courtès
@ 2023-03-30 11:21         ` Bruno Victal
  2023-03-31  2:10           ` Maxim Cournoyer
  2023-03-31 12:18           ` Ludovic Courtès
  2023-03-31 11:52         ` Bruno Victal
  1 sibling, 2 replies; 14+ messages in thread
From: Bruno Victal @ 2023-03-30 11:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62163, Maxim Cournoyer

On 2023-03-30 11:22, Ludovic Courtès wrote:
> Hi,
> 
> Bruno Victal <mirai@makinata.eu> skribis:
> 
>> On 2023-03-28 17:25, Ludovic Courtès wrote:
>>>
>>> Nope. :-)  What is ‘my-heartbeat-job’ doing?
>>
>> It queries shepherd to see if a service is running and sends a restart if required.
> 
> Isn’t that what #:respawn? #t is supposed to do?  :-)
> 
> If you find that #:respawn? doesn’t work, then we should fix it.

Oh, I should have explained better here.
Re-spawn works, it's the (daemon) service that might misbehave/go unresponsive without crashing,
i.e. HTTP backend stops responding to API requests but the server is still up.
The job performs a "health-check" and restarts it if it doesn't get the appropriate response.

A concrete situation where this could be of use is for logs.guix that occasionally stops
recording.


> 
> You can send messages to the bitbucket with:
> 
>   (parameterize ((shepherd-message-port (%make-void-port "w0")))
>     …)

Thanks!
I'm still curious as to exactly what/which lines cause shepherd to output the lines.


Cheers,
Bruno




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-30 11:21         ` Bruno Victal
@ 2023-03-31  2:10           ` Maxim Cournoyer
  2023-03-31 12:18           ` Ludovic Courtès
  1 sibling, 0 replies; 14+ messages in thread
From: Maxim Cournoyer @ 2023-03-31  2:10 UTC (permalink / raw)
  To: Bruno Victal; +Cc: Ludovic Courtès, 62163

Hi,

Bruno Victal <mirai@makinata.eu> writes:

> On 2023-03-30 11:22, Ludovic Courtès wrote:
>> Hi,
>> 
>> Bruno Victal <mirai@makinata.eu> skribis:
>> 
>>> On 2023-03-28 17:25, Ludovic Courtès wrote:
>>>>
>>>> Nope. :-)  What is ‘my-heartbeat-job’ doing?
>>>
>>> It queries shepherd to see if a service is running and sends a restart if required.
>> 
>> Isn’t that what #:respawn? #t is supposed to do?  :-)
>> 
>> If you find that #:respawn? doesn’t work, then we should fix it.
>
> Oh, I should have explained better here.
> Re-spawn works, it's the (daemon) service that might misbehave/go unresponsive without crashing,
> i.e. HTTP backend stops responding to API requests but the server is still up.
> The job performs a "health-check" and restarts it if it doesn't get the appropriate response.
>
> A concrete situation where this could be of use is for logs.guix that occasionally stops
> recording.

So some kind of supervisor for the job, that specific run time checks to
ensure the process is still doing its job, if I understand correctly.  I
wonder if this use case could be integrated into our Shepherd services
themselves, via some supervisor slot or similar, that would run some
script periodically.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-30 10:22       ` Ludovic Courtès
  2023-03-30 11:21         ` Bruno Victal
@ 2023-03-31 11:52         ` Bruno Victal
  2023-03-31 22:10           ` Ludovic Courtès
  1 sibling, 1 reply; 14+ messages in thread
From: Bruno Victal @ 2023-03-31 11:52 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62163, Maxim Cournoyer

On 2023-03-30 11:22, Ludovic Courtès wrote:
> 
> You can send messages to the bitbucket with:
> 
>   (parameterize ((shepherd-message-port (%make-void-port "w0")))
>     …)

While it does work for expunging them from mcron log, I noticed that
these lines are also polluting /var/log/messages and the snippet above
doesn't handle that.
Is there perhaps something else I'm missing?


Thanks,
Bruno




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-30 11:21         ` Bruno Victal
  2023-03-31  2:10           ` Maxim Cournoyer
@ 2023-03-31 12:18           ` Ludovic Courtès
  1 sibling, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2023-03-31 12:18 UTC (permalink / raw)
  To: Bruno Victal; +Cc: 62163, Maxim Cournoyer

Hi,

Bruno Victal <mirai@makinata.eu> skribis:

> On 2023-03-30 11:22, Ludovic Courtès wrote:

[...]

>>> It queries shepherd to see if a service is running and sends a restart if required.
>> 
>> Isn’t that what #:respawn? #t is supposed to do?  :-)
>> 
>> If you find that #:respawn? doesn’t work, then we should fix it.
>
> Oh, I should have explained better here.
> Re-spawn works, it's the (daemon) service that might misbehave/go unresponsive without crashing,
> i.e. HTTP backend stops responding to API requests but the server is still up.
> The job performs a "health-check" and restarts it if it doesn't get the appropriate response.

OK.  It still means that the service in question is kinda broken, right?

> A concrete situation where this could be of use is for logs.guix that occasionally stops
> recording.

Oh you mean ‘goggles-bot’?  Yeah I wonder why it occasionally goes
wrong, but really I think Someone™ should debug it (it’s a small script
in maintenance.git).

>> You can send messages to the bitbucket with:
>> 
>>   (parameterize ((shepherd-message-port (%make-void-port "w0")))
>>     …)
>
> Thanks!
> I'm still curious as to exactly what/which lines cause shepherd to output the lines.

The “Evaluating” line is emitted by shepherd, logged, and sent to
clients (for instance when you do ‘herd eval root '(+ 2 3)'’).

(gnu services herd) provides a client that echoes those messages to
‘shepherd-message-port’.

Does that make sense?

Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-31 11:52         ` Bruno Victal
@ 2023-03-31 22:10           ` Ludovic Courtès
  2023-04-27 13:24             ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2023-03-31 22:10 UTC (permalink / raw)
  To: Bruno Victal; +Cc: 62163, Maxim Cournoyer

Bruno Victal <mirai@makinata.eu> skribis:

> On 2023-03-30 11:22, Ludovic Courtès wrote:
>> 
>> You can send messages to the bitbucket with:
>> 
>>   (parameterize ((shepherd-message-port (%make-void-port "w0")))
>>     …)
>
> While it does work for expunging them from mcron log, I noticed that
> these lines are also polluting /var/log/messages and the snippet above
> doesn't handle that.
> Is there perhaps something else I'm missing?

Nope, you cannot prevent them from ending up in /var/log/messages; they
are purposefully logged.

Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-03-31 22:10           ` Ludovic Courtès
@ 2023-04-27 13:24             ` Ludovic Courtès
  2023-04-27 16:12               ` Bruno Victal
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2023-04-27 13:24 UTC (permalink / raw)
  To: Bruno Victal; +Cc: 62163, Maxim Cournoyer

Hi Bruno,

Ludovic Courtès <ludo@gnu.org> skribis:

> Bruno Victal <mirai@makinata.eu> skribis:
>
>> On 2023-03-30 11:22, Ludovic Courtès wrote:
>>> 
>>> You can send messages to the bitbucket with:
>>> 
>>>   (parameterize ((shepherd-message-port (%make-void-port "w0")))
>>>     …)
>>
>> While it does work for expunging them from mcron log, I noticed that
>> these lines are also polluting /var/log/messages and the snippet above
>> doesn't handle that.
>> Is there perhaps something else I'm missing?
>
> Nope, you cannot prevent them from ending up in /var/log/messages; they
> are purposefully logged.

What should we do about this bug?  Am I right that the conclusion is
that ‘my-heartbeat-job’ could send herd/shepherd output to the bit
bucket?  If yes, we can close this bug.

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-04-27 13:24             ` Ludovic Courtès
@ 2023-04-27 16:12               ` Bruno Victal
  2023-04-28  3:52                 ` Maxim Cournoyer
  2023-05-03 20:01                 ` Ludovic Courtès
  0 siblings, 2 replies; 14+ messages in thread
From: Bruno Victal @ 2023-04-27 16:12 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62163, Maxim Cournoyer

Hi Ludo’,

On 2023-04-27 14:24, Ludovic Courtès wrote:
> Hi Bruno,
> 
> Ludovic Courtès <ludo@gnu.org> skribis:
> 
>> Bruno Victal <mirai@makinata.eu> skribis:
>>
>>> On 2023-03-30 11:22, Ludovic Courtès wrote:
>>>>
>>>> You can send messages to the bitbucket with:
>>>>
>>>>   (parameterize ((shepherd-message-port (%make-void-port "w0")))
>>>>     …)
>>>
>>> While it does work for expunging them from mcron log, I noticed that
>>> these lines are also polluting /var/log/messages and the snippet above
>>> doesn't handle that.
>>> Is there perhaps something else I'm missing?
>>
>> Nope, you cannot prevent them from ending up in /var/log/messages; they
>> are purposefully logged.

Perhaps we could have a “low-noise” way to query for running services? (or non modifying actions done on shepherd)
Filling /var/log/messages with messages of (IMO) dubious value seems counterproductive.

> What should we do about this bug?  Am I right that the conclusion is
> that ‘my-heartbeat-job’ could send herd/shepherd output to the bit
> bucket?  If yes, we can close this bug.

Parameterizing the shepherd-message-port did cut the shepherd messages from the mcron log, yes.


Cheers,
Bruno




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-04-27 16:12               ` Bruno Victal
@ 2023-04-28  3:52                 ` Maxim Cournoyer
  2023-05-03 20:01                 ` Ludovic Courtès
  1 sibling, 0 replies; 14+ messages in thread
From: Maxim Cournoyer @ 2023-04-28  3:52 UTC (permalink / raw)
  To: Bruno Victal; +Cc: Ludovic Courtès, 62163-done

Hello,

Bruno Victal <mirai@makinata.eu> writes:

> Hi Ludo’,
>
> On 2023-04-27 14:24, Ludovic Courtès wrote:
>> Hi Bruno,
>> 
>> Ludovic Courtès <ludo@gnu.org> skribis:
>> 
>>> Bruno Victal <mirai@makinata.eu> skribis:
>>>
>>>> On 2023-03-30 11:22, Ludovic Courtès wrote:
>>>>>
>>>>> You can send messages to the bitbucket with:
>>>>>
>>>>>   (parameterize ((shepherd-message-port (%make-void-port "w0")))
>>>>>     …)
>>>>
>>>> While it does work for expunging them from mcron log, I noticed that
>>>> these lines are also polluting /var/log/messages and the snippet above
>>>> doesn't handle that.
>>>> Is there perhaps something else I'm missing?
>>>
>>> Nope, you cannot prevent them from ending up in /var/log/messages; they
>>> are purposefully logged.
>
> Perhaps we could have a “low-noise” way to query for running services? (or non modifying actions done on shepherd)
> Filling /var/log/messages with messages of (IMO) dubious value seems counterproductive.
>
>> What should we do about this bug?  Am I right that the conclusion is
>> that ‘my-heartbeat-job’ could send herd/shepherd output to the bit
>> bucket?  If yes, we can close this bug.
>
> Parameterizing the shepherd-message-port did cut the shepherd messages from the mcron log, yes.

Alright, closing then.

What a team :-).

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#62163: Suppress logging shepherd evaluation in mcron.log
  2023-04-27 16:12               ` Bruno Victal
  2023-04-28  3:52                 ` Maxim Cournoyer
@ 2023-05-03 20:01                 ` Ludovic Courtès
  1 sibling, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2023-05-03 20:01 UTC (permalink / raw)
  To: Bruno Victal; +Cc: 62163, Maxim Cournoyer

Hi,

Bruno Victal <mirai@makinata.eu> skribis:

>>>> While it does work for expunging them from mcron log, I noticed that
>>>> these lines are also polluting /var/log/messages and the snippet above
>>>> doesn't handle that.
>>>> Is there perhaps something else I'm missing?
>>>
>>> Nope, you cannot prevent them from ending up in /var/log/messages; they
>>> are purposefully logged.
>
> Perhaps we could have a “low-noise” way to query for running services? (or non modifying actions done on shepherd)
> Filling /var/log/messages with messages of (IMO) dubious value seems counterproductive.

The reasoning was that “eval is evil”, as we know :-), so we’d rather
log uses of ‘herd eval root’.

Ludo’.




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-05-03 20:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 15:59 bug#62163: Suppress logging shepherd evaluation in mcron.log Bruno Victal
2023-03-24 12:22 ` Maxim Cournoyer
2023-03-28 16:25   ` Ludovic Courtès
2023-03-28 16:32     ` Bruno Victal
2023-03-30 10:22       ` Ludovic Courtès
2023-03-30 11:21         ` Bruno Victal
2023-03-31  2:10           ` Maxim Cournoyer
2023-03-31 12:18           ` Ludovic Courtès
2023-03-31 11:52         ` Bruno Victal
2023-03-31 22:10           ` Ludovic Courtès
2023-04-27 13:24             ` Ludovic Courtès
2023-04-27 16:12               ` Bruno Victal
2023-04-28  3:52                 ` Maxim Cournoyer
2023-05-03 20:01                 ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.