mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-15 13:36:37 +00:00
use PVE::Tools::dump_logfile
This commit is contained in:
parent
a02d621810
commit
607263cbf6
@ -450,35 +450,11 @@ __PACKAGE__->register_method({
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
my $lines = [];
|
||||
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
my $user = $rpcenv->get_user();
|
||||
my $node = $param->{node};
|
||||
|
||||
my $fh = IO::File->new("/var/log/syslog", "r");
|
||||
die "unable to open file - $!" if !$fh;
|
||||
|
||||
my $start = $param->{start} || 0;
|
||||
my $limit = $param->{limit} || 50;
|
||||
my $count = 0;
|
||||
my $line;
|
||||
while (defined ($line = <$fh>)) {
|
||||
next if $count++ < $start;
|
||||
next if $limit <= 0;
|
||||
chomp $line;
|
||||
push @$lines, { n => $count, t => $line};
|
||||
$limit--;
|
||||
}
|
||||
|
||||
close($fh);
|
||||
|
||||
# HACK: ExtJS store.guaranteeRange() does not like empty array
|
||||
# so we add a line
|
||||
if (!$count) {
|
||||
$count++;
|
||||
push @$lines, { n => $count, t => "no content"};
|
||||
}
|
||||
my ($count, $lines) = PVE::Tools::dump_logfile("/var/log/syslog", $param->{start}, $param->{limit});
|
||||
|
||||
$rpcenv->set_result_count($count);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user