PHPackages                             ndarproj/laravel-logzip - 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. ndarproj/laravel-logzip

ActiveLibrary

ndarproj/laravel-logzip
=======================

Compress your laravel logs into a zip file with just one command

v1.0.0(5y ago)012MITPHPPHP ^7.2 | ^8.0

Since Mar 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ndarproj/laravel-logzip)[ Packagist](https://packagist.org/packages/ndarproj/laravel-logzip)[ RSS](/packages/ndarproj-laravel-logzip/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Compress laravel logs to a zip file
===================================

[](#compress-laravel-logs-to-a-zip-file)

This package allows you to compress or zip laravel logs with just one command.

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

[](#installation)

This package can be used in Laravel 5 or higher.

You can install the package via composer:

```
composer require ndarproj/laravel-logzip
```

```
- run this command if ever you encounter this error - Fatal error: Allowed memory size of 1610612736
composer self-update --2
```

Usage / Command
---------------

[](#usage--command)

To compress all .log files inside the storage/logs folder run:

```
php artisan log:zip
```

Schedule / Automate laravel log compression / zip with PM2
----------------------------------------------------------

[](#schedule--automate-laravel-log-compression--zip-with-pm2)

Install [pm2](https://github.com/Unitech/pm2) with NPM. You can download NPM [HERE](https://nodejs.org/en/download/)

```
npm install pm2 -g
```

Download this [FILE](https://github.com/ndarproj/laravel-logzip/blob/main/logzip.config.js) and place it inside your laravel root folder or create a new file and copy this code

```
module.exports = {
	apps: [
		{
			name: 'log-zip',
			interpreter: 'php',
			script: 'artisan',
			args: 'log:zip',
			watch: false,
			cron: '0 * * * *', // this would zip your logs hourly
			autorestart: false,
		}
	]
};
```

Update cron field to change the schedule. Reference:

To run pm2

```
pm2 start logzip.config.js
#if you created your own file
pm2 start
```

Configuration
-------------

[](#configuration)

If you need to change the name or allow deletion after compression, you can modify the config file.

You can publish config file with:

```
php artisan vendor:publish --provider="Ndarproj\\Logzip\\LogzipServiceProvider" --tag=config
```

This is the contents of the published config/rotate.php config file:

```
