niveshsaharan/laravel-logcleaner
Composer 安装命令:
composer require niveshsaharan/laravel-logcleaner
包简介
Keep your laravel logs small and tidy.
README 文档
README
Logs can get quite out of hand. This package helps save server space and keep your Laravel log files small.
- Trim your daily log to a given number of lines do it does not grow huge.
- Delete old daily logs, only keeping a given number of the latest log files.
-
Laravel 10 support as of 1.2.0.
-
Laravel 9 support as of 1.1.0.
-
Versions before that support Laravel 6, 7, 8.
Installation
You can install the package via composer:
composer require accentinteractive/laravel-logcleaner
Optionally you can publish the config file with:
php artisan vendor:publish --provider="Accentinteractive\LaravelLogcleaner\LaravelLogcleanerServiceProvider" --tag="config"
Usage
You can use logcleaner:run from the command line or set it as a cron job.
Command line usage;
// Get info about the command and options php artisan logcleaner:run --help // Trim big log files and delete old log files php artisan logcleaner:run // Pass the number of lines to keep when trimming log files. Overrides the config setting. // This overrides the default set in config php artisan logcleaner:run --keeplines=10000 // Pass the number of files to keep when deleting old log files. Overrides the config setting. // This overrides the default set in config php artisan logcleaner:run --keepfiles=7 // Run without actually cleaning any logs php artisan logcleaner:run --dry-run
Cron job usage, add this to App\Console\Kernel:
protected function schedule(Schedule $schedule) { $schedule->command('logcleaner:run')->daily()->at('01:00'); }
Of course, you can also pass options when defining a cron job.
protected function schedule(Schedule $schedule) { $schedule->command('logcleaner:run', ['--keeplines' => 5000, '--keepfiles' => 14])->daily()->at('01:00'); }
Config settings
You can pass config settings to modify the behaviour.
log_files_to_keep: the number of log files to keep when deleting old log files. This config setting is overridden by option--keepfileslog_lines_to_keep: the number of lines to leave intact when trimming log files. This config setting is overridden by option--keeplinesexclude: an array of filenames to exclude from processing, using wildcards.trimming_enabled: enables log file trimming.trueby default.deleting_enabled: enables old log file deletions.trueby default.
You can also pass options directly.
--keeplines=2000--keepfiles=7--dry-run
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email joost@accentinteractive.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
niveshsaharan/laravel-logcleaner 适用场景与选型建议
niveshsaharan/laravel-logcleaner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 767 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 04 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「accentinteractive」 「laravel-logcleaner」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 niveshsaharan/laravel-logcleaner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 niveshsaharan/laravel-logcleaner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 niveshsaharan/laravel-logcleaner 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Keep your laravel logs small and tidy.
Block bad bots and users that visit certain (exploit) urls for a set amount of time.
Test a string against a disallowlist. Useful for user forms and such.
Azure AD SSO (Single Sign On) login management for Laravel.
Do not process URLs with a extensions like .jpg, .png et cetera.
Validate data against one or multiple disallowlists, using the built-in Laravel validator or by calling the facade directly. Supports wildcards.
统计信息
- 总下载量: 767
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-26