From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pbs-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 7B8461FF187 for <inbox@lore.proxmox.com>; Wed, 9 Apr 2025 15:54:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 42AF09508; Wed, 9 Apr 2025 15:54:21 +0200 (CEST) From: Lukas Wagner <l.wagner@proxmox.com> To: pbs-devel@lists.proxmox.com Date: Wed, 9 Apr 2025 15:54:12 +0200 Message-Id: <20250409135412.306890-2-l.wagner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250409135412.306890-1-l.wagner@proxmox.com> References: <20250409135412.306890-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox 1/1] log: set up custom priority mapping for tracing-journald X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion <pbs-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/> List-Post: <mailto:pbs-devel@lists.proxmox.com> List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com> By default, the mapping between tracing/log error levels to syslog priorities is as follows: error! -> Error warn! -> Warning info! -> Notice debug! -> Informational trace! -> Debug Before using tracing-journald, we used `syslog` to write log messages to the journal. That one has the following mapping: error! -> Error warn! -> Warning info! -> Informational debug! -> Debug trace! -> Debug The changed mapping of info! log messages led to many messages being written with the Notice priority, which are formatted bold when running journalctl to view log messages. This commit changes the mapping so that it is the same as with the syslog crate. Support for custom priority mappings was only introduced in tracing-journald 0.3.1, so we have to bump the dependency to that version. Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> --- Cargo.toml | 2 +- proxmox-log/debian/control | 4 ++-- proxmox-log/src/lib.rs | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 268b39eb..bb7f6c07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,7 +111,7 @@ tokio-openssl = "0.6.1" tokio-stream = "0.1.0" tower-service = "0.3.0" tracing = "0.1" -tracing-journald = "0.3.0" +tracing-journald = "0.3.1" tracing-log = { version = "0.2", default-features = false } tracing-subscriber = "0.3.16" url = "2.2" diff --git a/proxmox-log/debian/control b/proxmox-log/debian/control index 4ad3f0f7..7e27b922 100644 --- a/proxmox-log/debian/control +++ b/proxmox-log/debian/control @@ -13,7 +13,7 @@ Build-Depends-Arch: cargo:native <!nocheck>, librust-tokio-1+default-dev (>= 1.6-~~) <!nocheck>, librust-tokio-1+rt-multi-thread-dev (>= 1.6-~~) <!nocheck>, librust-tracing-0.1+default-dev <!nocheck>, - librust-tracing-journald-0.3+default-dev <!nocheck>, + librust-tracing-journald-0.3+default-dev (>= 0.3.1-~~) <!nocheck>, librust-tracing-log-0.2+std-dev <!nocheck>, librust-tracing-subscriber-0.3+default-dev (>= 0.3.16-~~) <!nocheck> Maintainer: Proxmox Support Team <support@proxmox.com> @@ -36,7 +36,7 @@ Depends: librust-tokio-1+default-dev (>= 1.6-~~), librust-tokio-1+rt-multi-thread-dev (>= 1.6-~~), librust-tracing-0.1+default-dev, - librust-tracing-journald-0.3+default-dev, + librust-tracing-journald-0.3+default-dev (>= 0.3.1-~~), librust-tracing-log-0.2+std-dev, librust-tracing-subscriber-0.3+default-dev (>= 0.3.16-~~) Provides: diff --git a/proxmox-log/src/lib.rs b/proxmox-log/src/lib.rs index 7f041927..3a529cca 100644 --- a/proxmox-log/src/lib.rs +++ b/proxmox-log/src/lib.rs @@ -6,6 +6,7 @@ use std::future::Future; use std::sync::{Arc, Mutex}; use tokio::task::futures::TaskLocalFuture; +use tracing_journald::{Priority, PriorityMappings}; use tracing_subscriber::prelude::*; mod file_logger; @@ -115,7 +116,15 @@ where S: for<'a> tracing_subscriber::registry::LookupSpan<'a>, { match tracing_journald::layer() { - Ok(layer) => layer.boxed(), + Ok(layer) => layer + .with_priority_mappings(PriorityMappings { + error: Priority::Error, + warn: Priority::Warning, + info: Priority::Informational, + debug: Priority::Debug, + trace: Priority::Debug, + }) + .boxed(), Err(err) => { eprintln!("Unable to open syslog: {err:?}"); plain_stderr_layer().boxed() -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel