I have a group of log files (they are related but that's application level and not relevant). I want to set up logrotate
configuration on Debian linux to rotate the whole group (all the files) once any of them reaches the limit, say 100MB for example. I can't see such an option - any idea how to achieve that?
Asked
Active
Viewed 79 times
0

wick
- 147
- 1
- 10
-
there is and logrotatr is well documented. show us the research you have done – djdomi May 06 '23 at 19:22
-
@djdomi I have looked through the docs and I couldn't find the answer. Happy to share a photo of me reading. – wick May 07 '23 at 09:40
2 Answers
0
bash: man logrotate.conf
File selection
missingok
If the log file is missing, go on to the next one without issuing an error message. See also nomissingok.
nomissingok
If a log file does not exist, issue an error. This is the default.
ifempty
Rotate the log file even if it is empty, overriding the notifempty option (ifempty is the default).
notifempty
Do not rotate the log if it is empty (this overrides the ifempty option).
minage count
Do not rotate logs which are less than <count> days old.
maxage count
Remove rotated logs older than <count> days. The age is only checked if the logfile is to be rotated. rotate -1 does not hinder removal. The files are mailed to the configured address if maillast and mail are configured.
minsize size
Log files are rotated when they grow bigger than size bytes, but not before the additionally specified time interval (daily, weekly, monthly, or yearly). The related size option is similar except that it is mutually exclusive with the time interval options, and it
causes log files to be rotated without regard for the last rotation time, if specified after the time criteria (the last specified option takes the precedence). When minsize is used, both the size and timestamp of a log file are considered.
maxsize size
Log files are rotated when they grow bigger than size bytes even before the additionally specified time interval (daily, weekly, monthly, or yearly). The related size option is similar except that it is mutually exclusive with the time interval options, and it causes
log files to be rotated without regard for the last rotation time, if specified after the time criteria (the last specified option takes the precedence). When maxsize is used, both the size and timestamp of a log file are considered.
Source 1: Debian Bullseye "man" command
Source 2: https://linux.die.net/man/8/logrotate
The above, does include a Single file, while also use for a complete Sub-Directory
Full Examples
Here you decice, what, a single file, a bunch of .log or / any
/var/log/folder/*.log { minsize 10M maxsize 50M }
/var/log/folder/single.log { minsize 10M maxsize 50M }
/var/log/folder/* { minsize 10M maxsize 50M }
i think that will solve all your questions.

djdomi
- 1,599
- 3
- 12
- 19
-
it will not? where do you see rotating groups? Every file within a group is dealt with separately. It is unlikely `logrotate` can do what I ask for. – wick May 07 '23 at 16:44
-
sorry but question is unclear, you asked for limited the size, if you want to have this for the whole folder it is also possible – djdomi May 07 '23 at 17:19
-
no, I say "to rotate the whole group (all the files) once any of them reaches the limit". What in this wording makes you think of a folder? What makes you think it is possible? Please, delete your answer. – wick May 07 '23 at 17:53
-
-
I mean, I am very well familiar with logrotate. Your answers are irrelevant because what you drafted above is a standard selection. Every file is dealt with one by one. I had to use custom config and write up a script to trigger its forced mode manually to rotate all matching files as a group regardless criteria. Topic closed. – wick May 09 '23 at 19:52