6

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.

  • 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
11

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
  • 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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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