From 341422727ca22c1fba6d24a1cbe18c95b705d7cf Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 15 Jan 2018 15:18:04 +0100 Subject: [PATCH] add 'service' parameter to syslog api call so that we can filter the journal by service Signed-off-by: Dominik Csapak Reviewed-by: Thomas Lamprecht --- 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 ed6779e6..3eb38315 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@-', + }; + + $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);