How can I define the maximum number of log files in Laravel 5. I use daily log rotate, and I have "only" 5 log files in storage, I want to have the past 30 days, but I don't know how to do this, and I did not found any clue.
By default, Laravel is configured to create a single log file for your application, and this file is stored in app/storage/logs/laravel. log .
You can see the generated log entries in storage/logs/laravel. log file.
If you're having a space problem you can try using daily logs, it will automatically keep last X days of log (default 5). You can see it in Errors & Logging - Log Storage. Otherwise you can simply remove the storage/logs/laravel. log file or make a command to do so (like php artisane log:clear ).
The Laravel logging facilities provide a simple layer on top of the powerful Monolog library. By default, Laravel is configured to create daily log files for your application which are stored in the storage/logs directory. You may write information to the log like so: Log::info('This is some useful information.
Ok, it's now possible since v5.0.23. You just need to update laravel, and add this in your config/app.php
file:
'log_max_files' => 30
On Laravel 5.6
You can find config/logging.php
file:
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 30, // 0 for unilimitted logs
],
On Laravel 5.6 open file config/logging.php
on array daily change: 'days' => 30
If you want unlimited logs just put 0 instead 30.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With