PHPackages                             mathiasgrimm/laravel-log-keeper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. mathiasgrimm/laravel-log-keeper

AbandonedArchivedLibrary[Logging &amp; Monitoring](/categories/logging)

mathiasgrimm/laravel-log-keeper
===============================

Laravel Log Keeper helps rotating you logs while storing them anywhere you want with custom local/remote retention policies

v1.0.6(10y ago)10477.2k↓44.3%11[2 issues](https://github.com/mathiasgrimm/laravel-log-keeper/issues)PHP

Since Mar 12Pushed 3y ago2 watchersCompare

[ Source](https://github.com/mathiasgrimm/laravel-log-keeper)[ Packagist](https://packagist.org/packages/mathiasgrimm/laravel-log-keeper)[ RSS](/packages/mathiasgrimm-laravel-log-keeper/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (7)DependenciesVersions (8)Used By (0)

Laravel Log Keeper
==================

[](#laravel-log-keeper)

[![Author](https://camo.githubusercontent.com/91d0d3e94e3143d60f3dab6c8f445cd9ca7606e53d354c06fe8f8c0c4651558b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406d61746772696d6d2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/matgrimm)[![Latest Version](https://camo.githubusercontent.com/716c690576e8dfa0dbed11381a248d9213bbe49428c532c0f1ff709f537043f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6d6174686961736772696d6d2f6c61726176656c2d6c6f672d6b65657065722e7376673f7374796c653d666c61742d737175617265)](https://github.com/mathiasgrimm/laravel-log-keeper/releases)[![Total Downloads](https://camo.githubusercontent.com/57cbba7826ea2afb2ea0f1020d207ee5bf085d09a7715e24a98317cbd0325827/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6174686961736772696d6d2f6c61726176656c2d6c6f672d6b65657065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mathiasgrimm/laravel-log-keeper)

Laravel Log Keeper helps rotating your logs while storing them anywhere you want with custom local/remote retention policies.

A typical usage of Laravel Log Keeper would be to set a cron job to run daily and store local logs in a S3 bucket, (s)ftp, Dropbox or any other FileSystem driver

You can define a local and/or a remote retention, which by default is 7 and 30 days subsequently.

- Local files older than 7 days will be compressed using bzip2 and uploaded to the remote disk
- Remote files older than 30 days will be permanently deleted from the remote disk

### Highlights

[](#highlights)

- Have full control of where/when/how you archive you logs
- Prevent your server from running out of space
- Custom retention policies for Local and Remote archiving

Installation
------------

[](#installation)

Laravel Log Keeper is available via Composer:

```
{
    "require": {
        "mathiasgrimm/laravel-log-keeper": "1.*"
    }
}
```

Setup
-----

[](#setup)

### Laravel

[](#laravel)

#### Register Service Provider

[](#register-service-provider)

```
// config/app.php

'providers' => [
    ...
    MathiasGrimm\LaravelLogKeeper\Providers\LaravelServiceProvider::class,
    ...
],
```

#### Register the cron job

[](#register-the-cron-job)

```
// app/Console/Kernel.php

protected $commands = [
    ...
    \MathiasGrimm\LaravelLogKeeper\Commands\LogKeeper::class
    ...
];

...

protected function schedule(Schedule $schedule)
{
    ...
    $schedule->command('laravel-log-keeper')->daily();
    ...
}
```

### Log Format

[](#log-format)

To use Laravel Log Keeper your log files have to be in the daily format, which is defined in your `config/app.php`

```
    ...
    'log' => 'daily',
    ...
```

### Environment

[](#environment)

You can override the following variables placing them in your .env

Example:

```
# .env
...

LARAVEL_LOG_KEEPER_REMOTE_DISK           = "s3"
LARAVEL_LOG_KEEPER_LOCAL_RETENTION_DAYS  = 3
LARAVEL_LOG_KEEPER_REMOTE_RETENTION_DAYS = 15
LARAVEL_LOG_KEEPER_REMOTE_PATH           = "myproject1-prod-01"

...

```

```
    // laravel-log-keeper.php

    // ----------------------------------------------------------------------------
    // Enable or Disable the Laravel Log Keeper.
    // If it is set to false, no operations will be performed and it will be logged
    // if the logs are enabled
    // ----------------------------------------------------------------------------
    'enabled' => env('LARAVEL_LOG_KEEPER_ENABLED', true),

    // ----------------------------------------------------------------------------
    // Enable or Disable the Laravel Log Keeper for remote operations.
    // if it is set to false, the local files older than the local retention will be
    // delete without being uploaded to the remote disk
    // ----------------------------------------------------------------------------
    'enabled_remote' => env('LARAVEL_LOG_KEEPER_ENABLED_REMOTE', true),

    // ----------------------------------------------------------------------------
    // Where in the remote location it will be stored. You can leave it blank
    // or specify a custom folder like proj1-prod or proj1-integ so that you could
    // use the same s3 bucket for storing the logs in different environments
    // ----------------------------------------------------------------------------
    'remote_path' => rtrim(env('LARAVEL_LOG_KEEPER_REMOTE_PATH'), '/'),

    // ----------------------------------------------------------------------------
    // How many days a file will be kept on the local disk before
    // being uploaded to the remote disk.
    // Default is 7 days.
    // Local files with more than 7 days will be compressed using bzip2 and uploaded
    // to the remote disk. They will also be deleted from the local disk after being
    // uploaded
    // ----------------------------------------------------------------------------
    'localRetentionDays' => env('LARAVEL_LOG_KEEPER_LOCAL_RETENTION_DAYS', 7),

    // ----------------------------------------------------------------------------
    // How many days a file will be kept on the remote for.
    // The days here means days after the local retention. So 30 would actually
    // 30 + 7 = 37
    // Only files older than 37 days would be deleted from the remote disk
    // ----------------------------------------------------------------------------
    'remoteRetentionDays' => env('LARAVEL_LOG_KEEPER_REMOTE_RETENTION_DAYS', 30),

    'remoteRetentionDaysCalculated' =>
        env('LARAVEL_LOG_KEEPER_REMOTE_RETENTION_DAYS', 30) +
        env('LARAVEL_LOG_KEEPER_LOCAL_RETENTION_DAYS', 7),

    // ----------------------------------------------------------------------------
    // Which config/filesystems.php disk will be used for remote disk.
    // This would be typically a AWS S3 Disk, (s)ftp, Dropbox or any other configured
    // disk that will store the old logs
    // ----------------------------------------------------------------------------
    'remote_disk' => env('LARAVEL_LOG_KEEPER_REMOTE_DISK'),

    // ----------------------------------------------------------------------------
    // Define whether Laravel Log Keeper will log actions or not.
    // The log will be stored in the logs folders with name
    // laravel-log-keeper-{yyyy-mm-dd}.log
    // ----------------------------------------------------------------------------
    'log' => env('LARAVEL_LOG_KEEPER_LOG', true)
];
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mathias Grimm](https://github.com/mathiasgrimm)

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

7

Last Release

3746d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/56f4dbd80bb6510bdc2adc49fcf7ec925cb45535b3bfdadf0964a09d678cf8ab?d=identicon)[mathiasgrimm](/maintainers/mathiasgrimm)

---

Top Contributors

[![mathiasgrimm](https://avatars.githubusercontent.com/u/450069?v=4)](https://github.com/mathiasgrimm "mathiasgrimm (40 commits)")[![eblount](https://avatars.githubusercontent.com/u/1424719?v=4)](https://github.com/eblount "eblount (1 commits)")

---

Tags

logftplaravels3sftpremotedropboxdiskrotationdriveretention

### Embed Badge

![Health badge](/badges/mathiasgrimm-laravel-log-keeper/health.svg)

```
[![Health](https://phpackages.com/badges/mathiasgrimm-laravel-log-keeper/health.svg)](https://phpackages.com/packages/mathiasgrimm-laravel-log-keeper)
```

###  Alternatives

[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2861.7M63](/packages/creocoder-yii2-flysystem)[backup-manager/symfony

A simple database backup manager for Symfony2 with support for S3, Rackspace, Dropbox, FTP, SFTP.

119297.2k3](/packages/backup-manager-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
