all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] api2/node/syslog: use 'real_service_name' here also
@ 2020-11-11 12:41 Dominik Csapak
  2020-11-11 15:38 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2020-11-11 12:41 UTC (permalink / raw)
  To: pbs-devel

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





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

* [pbs-devel] applied: [PATCH proxmox-backup] api2/node/syslog: use 'real_service_name' here also
  2020-11-11 12:41 [pbs-devel] [PATCH proxmox-backup] api2/node/syslog: use 'real_service_name' here also Dominik Csapak
@ 2020-11-11 15:38 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2020-11-11 15:38 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

On 11.11.20 13:41, Dominik Csapak wrote:
> 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(-)
> 
>

How I love those helpers for edge cases ^^

applied, thanks!




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

end of thread, other threads:[~2020-11-11 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 12:41 [pbs-devel] [PATCH proxmox-backup] api2/node/syslog: use 'real_service_name' here also Dominik Csapak
2020-11-11 15:38 ` [pbs-devel] applied: " Thomas Lamprecht

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