]> git.proxmox.com Git - pmg-api.git/commitdiff
PMG/API2/Nodes.pm: add service parameter to syslog
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 4 Apr 2017 04:11:27 +0000 (06:11 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 4 Apr 2017 04:11:27 +0000 (06:11 +0200)
PMG/API2/Nodes.pm

index 27ea46941a1d88278e05512d41f54a15e8342901..28995eff0b7118c6cf6da98702095a3d1875f5c1 100644 (file)
@@ -143,17 +143,23 @@ __PACKAGE__->register_method({
                optional => 1,
            },
            since => {
-               type=> 'string',
+               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',
+               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,
            },
+           service => {
+               description => "Service ID",
+               type => 'string',
+               maxLength => 128,
+               optional => 1,
+           },
        },
     },
     returns => {
@@ -177,8 +183,14 @@ __PACKAGE__->register_method({
 
        my $restenv = PVE::RESTEnvironment::get();
 
-       my ($count, $lines) = PVE::Tools::dump_journal($param->{start}, $param->{limit},
-                                                      $param->{since}, $param->{'until'});
+       my $service = $param->{service};
+       if ($service && $service eq 'postfix') {
+           $service = 'postfix@-';
+       }
+
+       my ($count, $lines) = PVE::Tools::dump_journal(
+           $param->{start}, $param->{limit},
+           $param->{since}, $param->{'until'}, $service);
 
        $restenv->set_result_attrib('total', $count);