syslog: allow since/until parameters

allow the since/until parameters which journalctl understands
We use a really simple regex to check a valit date (time) stamp.

This can be done as this API call gets mainly used by the GUI where
we have full controll over what we send and additional journalctl
has already a good timestamp parser which can handle that.
This commit is contained in:
Thomas Lamprecht 2016-03-01 16:32:35 +01:00 committed by Dietmar Maurer
parent a1460d8db0
commit 01b753b6b1

View File

@ -535,6 +535,18 @@ __PACKAGE__->register_method({
minimum => 0,
optional => 1,
},
since => {
type=> 'string',
pattern => '^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}(:\d{2})?)?$',
description => "Display all log since this date-time string.",
optional => 1,
},
until => {
type=> 'string',
pattern => '^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}(:\d{2})?)?$',
description => "Display all log until this date-time string.",
optional => 1,
},
},
},
returns => {
@ -560,11 +572,12 @@ __PACKAGE__->register_method({
my $user = $rpcenv->get_user();
my $node = $param->{node};
my ($count, $lines) = PVE::Tools::dump_journal($param->{start}, $param->{limit});
my ($count, $lines) = PVE::Tools::dump_journal($param->{start}, $param->{limit},
$param->{since}, $param->{until});
$rpcenv->set_result_attrib('total', $count);
return $lines;
return $lines;
}});
my $sslcert;