Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
2  
Try running newsyslog -nv and see if it throws any errors. –  Chris S Nov 16 '11 at 14:11
2  
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
1  
@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
add comment

1 Answer

up vote 6 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
1  
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
add comment

Your Answer

 
discard

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.