From b484c0cc253ff9845fda130671004f5451fea84f Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 29 Dec 2025 17:52:35 +0000 Subject: [PATCH] fix(logs): Remove hardcoded 2000 line display limit The log viewer was artificially limiting display to 2000 lines regardless of user's requested amount. Users could request 10k, 40k, or 50k lines but only 2000 were ever shown. Changes: - Remove the hardcoded $maxDisplayLines = 2000 limit in the view - Add MAX_LOG_LINES constant (50,000) in GetLogs component - Enforce maximum limit in backend to prevent extremely large requests - Update input field with max attribute and tooltip Fixes #7803 --- app/Livewire/Project/Shared/GetLogs.php | 5 +++++ .../livewire/project/shared/get-logs.blade.php | 16 +++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.php index 8fda35a4a..0f8c4ad15 100644 --- a/app/Livewire/Project/Shared/GetLogs.php +++ b/app/Livewire/Project/Shared/GetLogs.php @@ -21,6 +21,8 @@ class GetLogs extends Component { + public const MAX_LOG_LINES = 50000; + public string $outputs = ''; public string $errors = ''; @@ -123,6 +125,9 @@ public function getLogs($refresh = false) if ($this->numberOfLines <= 0 || is_null($this->numberOfLines)) { $this->numberOfLines = 1000; } + if ($this->numberOfLines > self::MAX_LOG_LINES) { + $this->numberOfLines = self::MAX_LOG_LINES; + } if ($this->container) { if ($this->showTimeStamps) { if ($this->server->isSwarm()) { diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php index 03c049874..8deee486d 100644 --- a/resources/views/livewire/project/shared/get-logs.blade.php +++ b/resources/views/livewire/project/shared/get-logs.blade.php @@ -251,8 +251,8 @@ class="flex items-center justify-between gap-2 px-4 py-2 border-b dark:border-co
Lines: -
@if ($outputs) @php - // Limit rendered lines to prevent memory exhaustion - $maxDisplayLines = 2000; - $allLines = collect(explode("\n", $outputs))->filter(fn($line) => trim($line) !== ''); - $totalLines = $allLines->count(); - $hasMoreLines = $totalLines > $maxDisplayLines; - $displayLines = $hasMoreLines ? $allLines->slice(-$maxDisplayLines)->values() : $allLines; + $displayLines = collect(explode("\n", $outputs))->filter(fn($line) => trim($line) !== ''); @endphp
- @if ($hasMoreLines) -
- Showing last {{ number_format($maxDisplayLines) }} of {{ number_format($totalLines) }} lines -
- @endif
No matches found.