oneseven9955/logkeeper

LogKeeper archives old files based on a customizable time delta, ensuring your logs remain organized, and easily manageable.

Maintainers

Package info

github.com/179955/logkeeper

pkg:composer/oneseven9955/logkeeper

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2024-07-09 21:05 UTC

This package is auto-updated.

Last update: 2026-03-29 01:22:10 UTC


README

LogKeeper archives old files based on a customizable time delta, ensuring your logs remain organized, and easily manageable.

Getting Started

use OneSeven9955\LogKeeper\Config;
use OneSeven9955\LogKeeper\LogKeeper;

$config = new Config(
    path: '/path/to/log/files/*.log',
    timeDelta: \DateInterval::createFromDateString("1 month"),
);

$service = new LogKeeper(
    config: $config,
);

$service->run();

With custom old archive name:

$config = new Config(
    path: '/path/to/log/files/*.log',
    timeDelta: \DateInterval::createFromDateString("1 month"),
    oldPath: 'old/custom.zip', // Default: "old.zip"
);

Keep 30 old files:

$config = new Config(
    path: '/path/to/log/files/*.log',
    timeDelta: \DateInterval::createFromDateString("1 month"),
    oldCount: 30,
);

Remove all old files:

$config = new Config(
    path: '/path/to/log/files/*.log',
    timeDelta: \DateInterval::createFromDateString("1 month"),
    oldCount: 0,
);