11

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.

3
  • 2
    Try running newsyslog -nv and see if it throws any errors.
    – Chris S
    Nov 16, 2011 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, 2011 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. Nov 16, 2011 at 14:22

1 Answer 1

17

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
2
  • 1
    Congrats! Looks like the flag G, for glob(3). Nov 16, 2011 at 22:47
  • Reading man newsyslog helped as I see. Nov 17, 2011 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .