Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running FreeBSD 8.1. I am trying to make newsyslog rotate logs defined by a dynamic path:

# logfilename          [owner:group]    mode count size when  flags [/pid_file] [sig_num]
/path/logs/*.log    644  7     100  $D0   J
/path/logs/*/*.log  644  7     100  $D0   J

Basically I want newsyslog to rotate all files ending with .log in directory /path/logs/.

i also want to do the same for all subdirectories of /path/logs/ which is the second line of my config file.

But when I do:

newsyslog -F

No log files get rotated.

share|improve this question
Try running newsyslog -nv and see if it throws any errors. – Chris S Nov 16 '11 at 14:11
Side note: by default the archived log files will be placed in the same directory, and will have the new name service.log.0.bz2; meaning they will be picked up by newsyslog again because you've got an asterisk at the end of your glob pattern. This is almost certainly not the behavior you intend. – Chris S Nov 16 '11 at 14:13
@Chris S Thanks. Yeah I removed the wildcard from the end. Also all that was needed to make it work was to use -G flag. – Richard Knop Nov 16 '11 at 14:22
up vote 9 down vote accepted

Using the G flag in /etc/newsyslog.conf helped:

# logfilename          [owner:group]    mode count size when  flags [/pid_file] [sig_num]
/path/logs/*.log    644  7     100  $D0   G
/path/logs/*/*.log  644  7     100  $D0   G
share|improve this answer
Congrats! Looks like the flag G, for glob(3). – Stefan Lasiewski Nov 16 '11 at 22:47
Reading man newsyslog helped as I see. – SaveTheRbtz Nov 17 '11 at 22:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.