newsyslog.conf and Apache log files

Lowell Gilbert freebsd-questions-local at be-well.ilk.org
Thu Oct 7 20:32:50 UTC 2010


Joe Auty <joe at netmusician.org> writes:

> Lowell Gilbert wrote:
>> Joe Auty <joe at netmusician.org> writes:
>>
>>> Hello,
>>>
>>> I have the following entry for dealing with my Apache log files:
>>>
>>> /var/log/httpd/* 644 2 * $M1D0 GBJ
>>> /var/run/httpd.pid 30
>>>
>>>
>>> Unfortunately, this has created these big long log files such as the
>>> following:
>>>
>>> httpderror_log.2.bz2.2.bz2.2.bz2.1.bz2.1.bz2.1.bz2.0.bz2
>>>
>>> How can I prevent these dumb log file names from being created?
>>
>> Don't use wildcards in newsyslog.conf.
>>
>> What's happening is "httperror_log.2.bz2" gets rotated into
>> "httperror_log.2.baz2.1.bz2", because it matches the filename
>> glob you specified.
>
> Aha! That makes sense...
>
> What alternatives are there then so that I don't have to type in log
> file paths for each of my virtually hosted domains? How about:
>
> /var/log/httpd/*_log
>
>
> would this work?

I was going to say I didn't have time to figure it out, but it only took
me a couple of minutes of looking at the source to be (*kind of*) sure
that your suggestion *will* work.  It shouldn't take more than ten
minutes to try it out, anyway.

If that doesn't work for you, you could always try generating the
newsyslog.conf file from a script.  Or try one of the several other
logfile-rotating programs.  But I think your idea should be good.

Good luck.


More information about the freebsd-questions mailing list