From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] api2/node/syslog: use 'real_service_name' here also
Date: Wed, 11 Nov 2020 13:41:07 +0100 [thread overview]
Message-ID: <20201111124107.1365-1-d.csapak@proxmox.com> (raw)
for now this only does the 'postfix' -> 'postfix@-' conversion,
fixes the issue that we only showed the 'postfix' service syslog
(which is rather empty in a default setup) instead of the instance one
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/api2/node.rs | 2 +-
src/api2/node/services.rs | 2 +-
src/api2/node/syslog.rs | 8 +++++++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/api2/node.rs b/src/api2/node.rs
index a19bea7e..6c3e7967 100644
--- a/src/api2/node.rs
+++ b/src/api2/node.rs
@@ -34,7 +34,7 @@ pub mod subscription;
pub(crate) mod rrd;
mod journal;
-mod services;
+pub(crate) mod services;
mod status;
mod syslog;
mod time;
diff --git a/src/api2/node/services.rs b/src/api2/node/services.rs
index 4c2a17b4..40520208 100644
--- a/src/api2/node/services.rs
+++ b/src/api2/node/services.rs
@@ -22,7 +22,7 @@ static SERVICE_NAME_LIST: [&str; 7] = [
"systemd-timesyncd",
];
-fn real_service_name(service: &str) -> &str {
+pub fn real_service_name(service: &str) -> &str {
// since postfix package 3.1.0-3.1 the postfix unit is only here
// to manage subinstances, of which the default is called "-".
diff --git a/src/api2/node/syslog.rs b/src/api2/node/syslog.rs
index 28a79469..56662805 100644
--- a/src/api2/node/syslog.rs
+++ b/src/api2/node/syslog.rs
@@ -134,12 +134,18 @@ fn get_syslog(
mut rpcenv: &mut dyn RpcEnvironment,
) -> Result<Value, Error> {
+ let service = if let Some(service) = param["service"].as_str() {
+ Some(crate::api2::node::services::real_service_name(service))
+ } else {
+ None
+ };
+
let (count, lines) = dump_journal(
param["start"].as_u64(),
param["limit"].as_u64(),
param["since"].as_str(),
param["until"].as_str(),
- param["service"].as_str())?;
+ service)?;
rpcenv["total"] = Value::from(count);
--
2.20.1
next reply other threads:[~2020-11-11 12:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 12:41 Dominik Csapak [this message]
2020-11-11 15:38 ` [pbs-devel] applied: " Thomas Lamprecht
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=20201111124107.1365-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-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 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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal