Results 1 to 5 of 5
Hi all,
I have a logging server receiving multiple logs from various sources. In my /etc/logrotate.conf file, I have each sub-directory listed to custom rotate my logs. I'm at the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-09-2010 #1Just Joined!
- Join Date
- Aug 2010
- Posts
- 2
Logrotate custom logs
Hi all,
I have a logging server receiving multiple logs from various sources. In my /etc/logrotate.conf file, I have each sub-directory listed to custom rotate my logs. I'm at the 15+ sub-directory point, so the line containing the subdirectories is growing out of control, i.e:
I"m wondering if there is a way to specify just the list of subdirectories without having each one written on a single line for the logrotate directive. Thanks!Code:/var/log/subdir1/*.log /var/log/subdir2/*.log....... { <<parameters>> }
- 08-09-2010 #2Just Joined!
- Join Date
- Aug 2010
- Posts
- 89
Not tried in logrotate but work in the shell : /var/log/*/*.log
- 08-09-2010 #3Just Joined!
- Join Date
- Aug 2010
- Posts
- 2
I want to avoid the wildcard idea - ends up trying to rotate empty log folders. I'd like to be able to specify the folders, but hopefully in a more elegant way! Thanks.
- 08-10-2010 #4
logrotate rotates logs rather well with a number of options, and I think its support of wildcards might be the most elegant thing about it.
Having said that, you can tell it not to rotate files if they are empty. Although it may decend into an empty directory looking for files, the overhead is negligible I am sure. Further, you are already using a wildcard in one part of the string, and I believe you can specify a wildcard like "/var/log/subdir*/*.log," which seems like it would get you what you want with fewer path specs, and, hence, more elegantly.
- 08-10-2010 #5
And, of course, you don't have to put all the directories on one line. One per line is equally valid, and probably easier on the eyes.
Code:/var/log/dir1/* /var/log/dir2/* /var/log/dir3/* { # your stuff }


Reply With Quote
