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.