A log rotate tool written in rust.
Program will rotate log file or iterate through all log files in a directory and rotate them. Rotate tasks is configured in a yaml or json config file. See example.yaml for more details.
| Param | Description |
|---|---|
| path (Required) | Absolute path to rotate, can be a regular file or directory. |
| keep (Required) | File or directory keep num, including origin file or directory. (delete file if 0, truncate file if 1) |
| mode (Required) | Rotate mode can be MoveCreate or CopyTruncate. |
| depth | Recursive depth if path is directory. Depth is infinite if not set. |
| size | Only rotate file who's size grow bigger then configured size. Byte size suffix is supported e.g. KiB, mb, G. Note size is counted as storage size here, may different from apparent file size listed by ls -l |
| regex | Only rotate file who's name match regex. |
| precmd | Execute command before rotate. |
| postcmd | Execute command after rotate. |
- path: /foo/bar/dir
keep: 3
depth: 3
regex: ".+\\.log$"
mode: MoveCreate| Initial | Round #1 | Round #2 |
|---|---|---|
|
|
|