[! use strict; use Proxmox::Utils; use Proxmox::Form; use Proxmox::LogReader; use Proxmox::HTMLTable; !] [- my $cinfo = $fdat{__cinfo}; my $cid = $fdat{cid} || $udat{__cid} || $cinfo->{local}->{cid}; $udat{__cid} = $fdat{cid} if defined ($fdat{cid}); my $out = ""; if ($cinfo->{local}->{role} ne '-') { my $frm = Proxmox::Form->new (\%fdat); my @nodes; foreach my $ni (@{$cinfo->{nodes}}) { if ($ni->{cid} == $cinfo->{local}->{cid}) { push @nodes, [$ni->{cid}, "localhost ($ni->{ip})"]; } else { push @nodes, [$ni->{cid}, "$ni->{name} ($ni->{ip})"]; } } $frm->add_element("cid", "dynamicdropdown", $cid,'', \@nodes); my $html_form = $frm->out_js_code() . $frm->out_formheader(); $html_form .= ""; $html_form .= "

Cluster node selection: "; $html_form .= $frm->out_element("cid"); $html_form .= $frm->out_formfooter(); $out .= $html_form . "


"; } my $url = $req_rec->uri; $url .= "?m3=$fdat{m3}" if $fdat{m3}; my $page = $fdat{m3} || 0; my $max_files = -$page; my $page_size = 1000; my $cpos; my $lrcid = 0; $lrcid = $cid if $cinfo->{local}->{cid} != $cid; if ($fdat{frm_submit}) { $fdat{cpos} = undef; } if (!defined ($fdat{cpos})) { ($cpos) = @{Proxmox::LogReader->readlogpage ('syslog', $lrcid, $max_files, 0, $page_size)}; $cpos = int (($cpos -1)/$page_size) * $page_size; } else { $cpos = $fdat{cpos}; } my ($max, $entries) = @{Proxmox::LogReader->readlogpage ('syslog', $lrcid, $max_files, $cpos, $page_size)}; if ($entries) { $out .= Proxmox::HTMLTable::generate_page_navigator ($url, $max, $page_size, $cpos); $out .= "
"; $out .= Proxmox::HTMLTable::create_log_table ($entries, [__('Time'), __('Process'), __('Info')]); } else { $out .= "

" . __("Log file is empty") . ".

" } print OUT $out; -]