diff --git a/extensions/Servers/Proxmox/Livewire/Firewall.php b/extensions/Servers/Proxmox/Livewire/Firewall.php index 4b6975049..b9d2a1be5 100644 --- a/extensions/Servers/Proxmox/Livewire/Firewall.php +++ b/extensions/Servers/Proxmox/Livewire/Firewall.php @@ -802,7 +802,10 @@ class Firewall extends Component $response = $this->firewallRequest( '/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/firewall/log', 'get', - ['limit' => $this->logLimit] + [ + 'limit' => $this->logLimit, + 'start' => 0 + ] ); if (! $response->successful()) { @@ -830,18 +833,21 @@ class Firewall extends Component $rawLogs = []; if (! empty($body)) { - // Split by newlines and filter empty lines - $lines = explode("\n", trim($body)); + // Split by newlines (handle both \n and \r\n) + $lines = preg_split('/\r\n|\r|\n/', $body); $rawLogs = array_filter($lines, static function ($line) { return ! empty(trim($line)); }); + // Re-index array after filtering + $rawLogs = array_values($rawLogs); } - \Log::debug('Firewall logs fetched from Proxmox API', [ + \Log::info('Firewall logs fetched from Proxmox API', [ 'raw_count' => count($rawLogs), 'body_length' => strlen($body), 'content_type' => $response->header('Content-Type'), 'sample' => ! empty($rawLogs) ? substr($rawLogs[array_key_first($rawLogs)], 0, 200) : null, + 'first_5_lines' => array_slice($rawLogs, 0, 5), ]); $this->firewallLogs = []; @@ -871,6 +877,11 @@ class Firewall extends Component $this->firewallLogs[] = $this->parseFirewallLog($logText); } + \Log::info('Firewall logs final count', [ + 'total_logs' => count($this->firewallLogs), + 'first_3_sources' => array_slice(array_column($this->firewallLogs, 'source'), 0, 3), + ]); + if (empty($this->firewallLogs) && ! empty($rawLogs)) { $this->logError = 'Logs received but could not be processed.'; } elseif (empty($this->firewallLogs)) { diff --git a/extensions/Servers/Proxmox/views/firewall.blade.php b/extensions/Servers/Proxmox/views/firewall.blade.php index 4da1f5735..9cb500df9 100644 --- a/extensions/Servers/Proxmox/views/firewall.blade.php +++ b/extensions/Servers/Proxmox/views/firewall.blade.php @@ -295,7 +295,7 @@
Recent firewall activity and blocked/allowed connections
+Recent firewall activity and blocked/allowed connections ({{ count($firewallLogs) }} entries loaded)