I am trying to use logrotate to rotate our web logs for our various vhosted sites to cut down on space and rotate out old logs that are not necessary to keep around personally. What Im curious to find out, is how supported extended regular expressions is within the logrotate.conf file. More specifically, will logrotate be smart enough to decipher the following:
/path/to/logs/access_log.www.*.(com|org|net|us)
The filename format for my logs are: access_log.www.domain.com/net/org/us.
Thank you in advance.
Sol
On Wed, Sep 23, 2009 at 11:33:32AM -0400, Sol Fulop wrote:
I am trying to use logrotate to rotate our web logs for our various vhosted sites to cut down on space and rotate out old logs that are not necessary to keep around personally. What Im curious to find out, is how supported extended regular expressions is within the logrotate.conf file. More specifically, will logrotate be smart enough to decipher the following:
/path/to/logs/access_log.www.*.(com|org|net|us)
AFAIK, logrotate doesn't support regular expressions, only wildcards (* and ?).
Is there a way around that??? Like run a command to get all the filenames then pipe it to the config directive /path/to/logs/access_log.www.*.(com|org|net|us) {} in logrotate.conf?
Sol
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Luciano Rocha Sent: Wednesday, September 23, 2009 11:39 AM To: CentOS mailing list Subject: Re: [CentOS] logrotate and regular expressions
On Wed, Sep 23, 2009 at 11:33:32AM -0400, Sol Fulop wrote:
I am trying to use logrotate to rotate our web logs for our various vhosted sites to cut down on space and rotate out old logs that are not necessary to keep around personally. What Im curious to find out,
is how supported extended regular expressions is within the logrotate.conf file. More specifically, will logrotate be smart enough to decipher the following:
/path/to/logs/access_log.www.*.(com|org|net|us)
AFAIK, logrotate doesn't support regular expressions, only wildcards (* and ?).
-- lfr 0/0
On Wed, Sep 23, 2009 at 11:51:04AM -0400, Sol Fulop wrote:
Is there a way around that??? Like run a command to get all the filenames then pipe it to the config directive /path/to/logs/access_log.www.*.(com|org|net|us) {} in logrotate.conf?
In that particular instance, you can use: /path/to/logs/access_log.www.*.com /path/to/logs/access_log.www.*.org \ /path/to/logs/access_log.www.*.net /path/to/logs/access_log.www.*.us { compress daily ... }
I don't know if *.{com,org,net,us} works, never tried it. You could also regenerate the configuration daily from a template file.
Sol Fulop wrote:
Is there a way around that??? Like run a command to get all the filenames then pipe it to the config directive /path/to/logs/access_log.www.*.(com|org|net|us) {} in logrotate.conf?
You might be able to do something like:
/path/to/logs/access_log.www.*.com /path/to/logs/access_log.www.*.org ... {}
James Pearson
Sol Fulop wrote:
Is there a way around that??? Like run a command to get all the filenames then pipe it to the config directive /path/to/logs/access_log.www.*.(com|org|net|us) {} in logrotate.conf?
Generate your logrotate config dynamically if nothing else, that's what scripting is for, run a cron that runs a few minutes before logrotate to update the config to include any of the latest files and logrotate will pick it up. Or create a separate logrotate config for each site and drop it in a directory and have logrotate include all configs in that directory.
nate
Hi,
"Sol Fulop" sfulop@core101.com schrieb am 23.09.2009 17:33:32:
I am trying to use logrotate to rotate our web logs for our various vhosted sites to cut down on space and rotate out old logs that are not necessary to keep around personally. What Im curious to find out, is how supported extended regular expressions is within the logrotate.conf file.
Ok... logrotate(8) is unpleasantly unspecific about that, though from googling [1], and reading glob(3) I believe that globbing is available through (g)libc which logrotate is linked to:
# ldd /usr/sbin/logrotate libpopt.so.0 => /usr/lib64/libpopt.so.0 (0x0000003c8c000000) libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003c88000000) libc.so.6 => /lib64/libc.so.6 (0x0000003c86800000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003c87000000) libsepol.so.1 => /lib64/libsepol.so.1 (0x0000003c87c00000) /lib64/ld-linux-x86-64.so.2 (0x0000003c86400000)
So I guess you can use glob(7) (as stated in [1]).
Frank.
[1] http://www.mail-archive.com/kplug-list@kernel-panic.org/msg10293.html
I did find that info on google as well, but, that other info regarding globbing was extremely helpful thanks ;).
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Frank.Brodbeck@klingel.de Sent: Thursday, September 24, 2009 3:33 AM To: CentOS mailing list Subject: [CentOS] Antwort: logrotate and regular expressions
Hi,
"Sol Fulop" sfulop@core101.com schrieb am 23.09.2009 17:33:32:
I am trying to use logrotate to rotate our web logs for our various vhosted sites to cut down on space and rotate out old logs that are not necessary to keep around personally. What Im curious to find out, is how supported extended regular expressions is within the logrotate.conf file.
Ok... logrotate(8) is unpleasantly unspecific about that, though from googling [1], and reading glob(3) I believe that globbing is available through (g)libc which logrotate is linked to:
# ldd /usr/sbin/logrotate libpopt.so.0 => /usr/lib64/libpopt.so.0 (0x0000003c8c000000) libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003c88000000) libc.so.6 => /lib64/libc.so.6 (0x0000003c86800000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003c87000000) libsepol.so.1 => /lib64/libsepol.so.1 (0x0000003c87c00000) /lib64/ld-linux-x86-64.so.2 (0x0000003c86400000)
So I guess you can use glob(7) (as stated in [1]).
Frank.
[1] http://www.mail-archive.com/kplug-list@kernel-panic.org/msg10293.html _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos