newsyslog and file globbing

The manpage NEWSYSLOG.CONF(5) contains this:
logfile_name
Name of the system log file to be archived, or one of the literal
strings “⟨default⟩”, or “⟨include⟩”. The special default entry
will only be used if a log file name is given as a command line
argument to newsyslog(8), and if that log file name is not
matched by any other line in the configuration file. The include
entry is used to include other configuration files and supports
globbing.
However, adding this to /etc/newsyslog.conf.d/apache24.conf:

Code:
/var/log/httpd/apache24/main_*.log                644  14     *   $M1D0  JB     /var/run/httpd.pid 30

and running newsyslog -v gives this:

Code:
/var/log/httpd/apache24/main_*.log" <14J>: does not exist, skipped

But ll /var/log/httpd/apache24/main_*.log shows this:
Code:
-rw-r--r--  1 root  wheel  3495 Mar  7 12:30 /var/log/httpd/apache24/main_error.log
-rw-r--r--  1 root  wheel     0 May 10  2022 /var/log/httpd/apache24/main_httpd_access.log
-rw-r--r--  1 root  wheel     0 May 10  2022 /var/log/httpd/apache24/main_httpd_access_ssl.log
-rw-r--r--  1 root  wheel   390 May 11  2022 /var/log/httpd/apache24/main_httpd_error.log
-rw-r--r--  1 root  wheel     0 May 10  2022 /var/log/httpd/apache24/main_httpd_io_access.log
-rw-r--r--  1 root  wheel     0 Mar  1 00:00 /var/log/httpd/apache24/main_io_access.log

Does newsyslog support file globbing or not? If it does then is there a specific syntax to get it to work?
 
newsyslog has a "G" flag that would help here. From `man 5 newsyslog.conf` https://man.freebsd.org/cgi/man.cgi?newsyslog.conf
Code:
G       indicates  that    the  specified logfile_name is a shell
               pattern,    and that newsyslog(8) should archive all file-
               names matching that pattern using the other options  on
               this  line.   See  glob(3)  for    details     on syntax and
               matching    rules.

So you'd end up with

Code:
/var/log/httpd/apache24/main_*.log                644  14     *   $M1D0  JBG     /var/run/httpd.pid SIGUSR1
 
[…] Does newsyslog support file globbing or not? […]
Yes, newsyslog(8) supports globbing, however, without the G flag brnrd mentioned only for the special <include> file name. ?‍? newsyslog.conf(5) mentions globbing only in the sentence about the special include directive, not in any preceding sentences about which log files to rotate.​
logfile_name
Name of the system log file to be archived, or one of the literal strings <default>, or <include>. […] The include entry is used to include other configuration files and supports globbing.​
That means you can write​
Code:
<include> /etc/newsyslog.conf.d/[!.]*.conf
<include> /usr/local/etc/newsyslog.conf.d/[!.]*.conf
for drop‑in configuration snippets. ?​
 
Back
Top