Posted by & filed under AWS/Linux/Unix/Devops stuff.

If you are interested in using newsyslog (included in FreeBSD) to rotate a folder of log files without having to specify each individual log file path in your /etc/newsyslog.conf, you can do so making use of a wildcard, with an important catch…If you are interested in using newsyslog (included in FreeBSD) to rotate a folder of log files without having to specify each individual log file path in your /etc/newsyslog.conf, you can do so making use of a wildcard, with an important catch. If you simply include the following in your configuration:

/var/log/httpd/* 644 2 * $M1D0 GBJ /var/run/httpd.pid 30

this will also re-compress files that have already been compressed, giving you an endless number of files with suffixes such as 1.bz2.1.bz2, and so on. Instead, enter the following into your configuration:

/var/log/httpd/*.log 644 2 * $M1D0 GBJ /var/run/httpd.pid 30

This will zero in on your compressed files. Be sure to restart newsyslog once you have made this change (/etc/rc.d/newsyslog restart)