oneseven9955/logkeeper

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

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/oneseven9955/logkeeper

0.1.0 2024-07-09 21:05 UTC

This package is auto-updated.

Last update: 2025-12-29 04:08:24 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,
);