public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Fiona Ebner <f.ebner@proxmox.com>,
	Friedrich Weber <f.weber@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 storage] lvm: improve warning in case vgs output contains unexpected lines
Date: Fri, 2 Feb 2024 17:27:21 +0100	[thread overview]
Message-ID: <d4d8b379-af55-4ae9-aed7-206d623c0cb6@proxmox.com> (raw)
In-Reply-To: <9dc55104-f106-4602-9100-7eeac227caa7@proxmox.com>

Am 01/02/2024 um 10:20 schrieb Fiona Ebner:
> Am 31.01.24 um 12:55 schrieb Friedrich Weber:
>>
>> After changing `warn` to `log_warn` I noticed that pvestatd does not
>> write the warning to the syslog every 10s anymore. Turns out `warn`
>> triggers a custom __WARN__ handler we install for our daemons which also
>> writes to syslog (e.g. pvestatd [1]). But `log_warn` only writes to
>> stderr [2], thus the `log_warn` warning is not written to the syslog.
>>
>> Briefly discussed with Fiona off-list, she suggested to try replacing
>> `print` in `log_warn` with `warn` [2]. But with this, all `log_warn`
>> warnings also appear in the syslog (e.g. the "no efidisk configured"
>> warning [3]), which I think would be too spammy.
>>
> 
> But that is the original intention behind the __WARN__ handler. I'd
> argue that replacing a warn with a log_warn() shouldn't change these
> semantics. The intention of log_warn() was to make warnings more visible
> in task logs. Making them less visible outside of tasks was not intended!

Not sure if I agree 100% with that, IMO it can be fine to say that both
are different things, not every task log warnings needs to be in the
syslog just like not every syslog warning that happens while being
inside a worker needs to go in the task log.

Albeit it's definitively safer to log task log warnings inside syslog,
as that is mostly accessible for users/api-tokens that have node wide
sys.audit already.

> 
> The issue that task warnings also appear in syslog for pvedaemon and
> others is a bit orthogonal and can be fixed too.
> 
> My proposed solutions:
> 
> 1) Switch to using "warn" instead of "print STDERR" in log_warn() and
> either:
> 1A) Clear the inherited __WARN__ handler in fork_worker().
> 1B) Have the __WARN__ handler check if it's in a worker and only log to
> syslog if it's not.


> 
> 2. Keep using "print STDERR" in log_warn() and do print to syslog there
> if not in a worker.

why not unconditionally? I.e., just call syslog inside log_warn too?
While that would affect a  few CLI usages that might not syslog now, but
one could argue that this would not really matter.


> 
>> I'd suggest I use `log_warn` in this patch and keep `log_warn` as it is
>> (printing only to stderr) for now. The downside is that pvestatd will
>> not log the `vgs` warning to the syslog anymore (but doing that every 10
>> seconds could also be considered spammy anyway). The upside is that e.g.

yeah, some log-rate limiting could sometimes be nice, but that has a
surprisingly high management complexity if one still wants to keep good
UX (i.e., report every X logs, or with a timeout, that a specific log
was suppressed)

>> a qmstart task log has the warning in its task log and shows "Warnings:
>> 1" in the GUI, which might be better for visibility than a syslog
>> message anyway.
>>
> 
> This is something that could be solved with an intermediate log level,
> but that requires new infrastructure of course. If it important enough
> to be a warning, then I don't see an issue with pvestatd logging it. If
> it's not, maybe we need a log_info() for such messages (and allow users
> to configure if they want infos too)?

We can too all the levels, log_notice could even show up in the UI,
log_info would be regular without special task state.
But that would not solve the question about when to log to syslog too,
as that's not something that one can derive just from the log level IMO.




      parent reply	other threads:[~2024-02-02 16:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 11:11 Friedrich Weber
2024-01-19 10:59 ` Fiona Ebner
2024-01-19 11:31   ` Fiona Ebner
2024-01-23 10:01     ` Friedrich Weber
2024-01-31 11:55       ` Friedrich Weber
2024-02-01  9:20         ` Fiona Ebner
2024-02-01  9:30           ` Fiona Ebner
2024-02-02 16:27           ` Thomas Lamprecht [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4d8b379-af55-4ae9-aed7-206d623c0cb6@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=f.weber@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal