Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Log Cleaner Laravel Package

jiordiviera/laravel-log-cleaner

Laravel Log Cleaner helps you purge old Laravel log files automatically. Configure retention rules and schedule cleanup via Artisan/cron to keep storage tidy, prevent large logs, and reduce disk usage with minimal setup.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • DevOps/Infrastructure Efficiency: Automate log cleanup to reduce storage costs and improve system performance, especially for production environments with large log files.
  • Compliance & Retention Policies: Enforce log retention rules (e.g., GDPR, SOX) by programmatically purging logs older than a specified threshold (e.g., 30/90 days).
  • Build vs. Buy: Avoid reinventing a log-cleanup solution; leverage this lightweight, configurable package instead of custom scripts or third-party tools.
  • CI/CD Integration: Schedule log cleanup as part of deployment pipelines (e.g., post-deploy) to ensure logs don’t bloat storage or slow down future operations.
  • Multi-Environment Support: Standardize log management across dev/staging/prod with configurable retention policies per environment.
  • Incident Response: Quickly clear logs during security investigations or debugging sessions while preserving critical error logs (e.g., --level=ERROR).
  • Cost Optimization: Reduce cloud storage costs (e.g., AWS S3, EBS) by automating log rotation and cleanup.
  • Audit Trails: Retain backups of cleared logs for compliance or forensic analysis (e.g., --backup).
  • Scalability: Handle large log files efficiently with memory-efficient processing and compression options.

When to Consider This Package

  • Adopt if:

    • Your Laravel app generates large log files (>100MB) that need regular cleanup.
    • You lack a centralized logging solution (e.g., ELK, Datadog) and manage logs locally.
    • You need granular control over log retention (e.g., keep only errors, purge logs older than X days).
    • Your team prefers CLI-driven operations over manual file deletion.
    • You require safety features like dry runs, backups, or compression before deletion.
    • You’re using Laravel 9+ and PHP 8.1+.
  • Look elsewhere if:

    • You use a managed logging service (e.g., AWS CloudWatch, Papertrail) that handles retention automatically.
    • Your logs are structured (JSON) and require parsing before cleanup (consider a custom script or logrotate).
    • You need real-time log analysis during cleanup (this package truncates files, not streams them).
    • Your environment has strict file-locking constraints (e.g., shared storage with concurrent writers).
    • You require log archiving (e.g., exporting to cold storage) beyond simple backups.
    • Your team prefers GUI tools (e.g., Laravel Horizon’s log management) over CLI.

How to Pitch It (Stakeholders)

For Executives: "This package automates log cleanup in our Laravel apps, saving storage costs and reducing manual DevOps overhead. With configurable retention policies (e.g., purge logs older than 30 days), we can enforce compliance while keeping critical error logs. It’s a lightweight, open-source solution that integrates seamlessly with our existing CI/CD pipelines—no third-party dependencies or upfront costs. For example, we can schedule php artisan log:clear --days=30 --backup post-deploy to keep storage lean without losing audit trails."

For Engineering Teams: *"Laravel Log Cleaner replaces ad-hoc log deletion with a safe, configurable, and efficient Artisan command. Key benefits:

  • Retention Control: Keep logs for X days or by severity (e.g., --level=ERROR).
  • Safety Nets: Dry runs (--dry-run), backups (--backup), and compression (--compress) prevent accidental data loss.
  • Performance: Memory-efficient processing handles large files without crashing.
  • Extensibility: Events and programmatic usage (e.g., LogCleaner::clearOld(30)) let us integrate cleanup into custom workflows.
  • Zero Maintenance: No need to manage custom scripts or cron jobs—just run php artisan log:clear."*

For DevOps/SREs: *"This tool standardizes log management across environments and reduces toil:

  • Automate Compliance: Enforce retention policies (e.g., 90-day max) via config or CLI flags.
  • Storage Savings: Compress old logs (--compress) or delete them entirely, cutting cloud storage costs.
  • Incident Readiness: Quickly clear logs during investigations while preserving errors (--level=ERROR).
  • CI/CD Friendly: Add to deployment scripts to ensure logs don’t bloat storage over time.
  • Audit Trails: Backups (--backup) retain logs for forensic analysis if needed."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle