Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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:

    /var/log/subdir1/*.log /var/log/subdir2/*.log....... {
    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!

  2. #2
    Not tried in logrotate but work in the shell : /var/log/*/*.log

  3. #3
    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.

  4. $spacer_open
  5. #4
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Charlotte, NC, USA
    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.

  6. #5
    Just Joined! apekool404's Avatar
    Join Date
    Dec 2006
    Amsterdam, Netherlands
    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.

    /var/log/dir3/* {
        # your stuff

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts