[pve-devel] [PATCH manager v2 16/22] add 'service' parameter to syslog api call

Dominik Csapak d.csapak at proxmox.com
Mon Jan 15 15:18:04 CET 2018


so that we can filter the journal by service

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Nodes.pm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index f11fd169..bc0ac664 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -565,6 +565,12 @@ __PACKAGE__->register_method({
 		description => "Display all log until this date-time string.",
 		optional => 1,
 	    },
+	    service => {
+		description => "Service ID",
+		type => 'string',
+		maxLength => 128,
+		optional => 1,
+	    },
 	},
     },
     returns => {
@@ -589,9 +595,18 @@ __PACKAGE__->register_method({
 	my $rpcenv = PVE::RPCEnvironment::get();
 	my $user = $rpcenv->get_user();
 	my $node = $param->{node};
+	my $service;
+
+	if ($param->{service}) {
+	    my $service_aliases = {
+		'postfix' => 'postfix at -',
+	    };
+
+	    $service = $service_aliases->{$param->{service}} // $param->{service};
+	}
 
 	my ($count, $lines) = PVE::Tools::dump_journal($param->{start}, $param->{limit},
-						       $param->{since}, $param->{until});
+						       $param->{since}, $param->{until}, $service);
 
 	$rpcenv->set_result_attrib('total', $count);
 
-- 
2.11.0





More information about the pve-devel mailing list