Discussion:
file receives no input after turn over by newsyslog(8)
(too old to reply)
Cary
2016-05-09 22:27:03 UTC
Permalink
Hi all,

Perhaps someone might be able to help.
The /var/log/httpd-access.log file is turned over at least
once a week on a VPS running 10.2-Stable.

/var/log/httpd-*.log 644 10 500 * GX

is the line I have in /etc/newsyslog.conf.

After the file is turned over no messages are saved from the apache24
daemon. There is just a line from newsyslog(8) with the date, hostname
process number and a message that the file was turned over.

After restarting httpd(8) all messages are logged again.
Other httpd-* log files are do not fill up as quickly, but are
probably affected as well. How can I keep getting logs from
the server without a service restart?
--
***@sdf.org
SDF Public Access UNIX System - http://sdf.org
Cody Swanson
2016-05-09 23:59:59 UTC
Permalink
Cary,

I've been using cronolog (/usr/ports/sysutils/cronolog) for many years with great success to keep my apache logs rotated. In httpd.conf (or your vhost config) put something similar:

CustomLog "|/usr/local/sbin/cronolog /path/to/www/logs/%Y-%m-access.log" combined

Cronolog is smart enough to know when to rotate the logs based on your customlog string. The above gives me 1 log a month for my personal low traffic sites, busier sites may want to go daily or hourly to avoid huge logs.


----- Original Message -----
From: "Cary" <***@SDF.ORG>
To: freebsd-***@freebsd.org
Sent: Monday, May 9, 2016 4:27:03 PM
Subject: file receives no input after turn over by newsyslog(8)

Hi all,

Perhaps someone might be able to help.
The /var/log/httpd-access.log file is turned over at least
once a week on a VPS running 10.2-Stable.

/var/log/httpd-*.log 644 10 500 * GX

is the line I have in /etc/newsyslog.conf.

After the file is turned over no messages are saved from the apache24
daemon. There is just a line from newsyslog(8) with the date, hostname
process number and a message that the file was turned over.

After restarting httpd(8) all messages are logged again.
Other httpd-* log files are do not fill up as quickly, but are
probably affected as well. How can I keep getting logs from
the server without a service restart?
--
***@sdf.org
SDF Public Access UNIX System - http://sdf.org
_______________________________________________
freebsd-***@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-***@freebsd.org"
markham breitbach
2016-05-10 00:20:00 UTC
Permalink
The problem here is that httpd opens a file handle and keeps it open for
the log, so after it is rotated, the file handle follows the old file.
(you should still see entries showing up in the log.0).

There are many articles written about this, but the idea is you need to
send apache a signal to release the file handle and start writing to the
new log. This is the first page that comes up in google:

http://mikkel.hoegh.org/2009/10/08/rotating-apache-httpd-logfiles-freebsd/

-M
Post by Cary
Hi all,
Perhaps someone might be able to help.
The /var/log/httpd-access.log file is turned over at least
once a week on a VPS running 10.2-Stable.
/var/log/httpd-*.log 644 10 500 * GX
is the line I have in /etc/newsyslog.conf.
After the file is turned over no messages are saved from the apache24
daemon. There is just a line from newsyslog(8) with the date, hostname
process number and a message that the file was turned over.
After restarting httpd(8) all messages are logged again.
Other httpd-* log files are do not fill up as quickly, but are
probably affected as well. How can I keep getting logs from
the server without a service restart?
Cary
2016-05-10 04:49:14 UTC
Permalink
Post by markham breitbach
The problem here is that httpd opens a file handle and keeps it open for
the log, so after it is rotated, the file handle follows the old file.
(you should still see entries showing up in the log.0).
There are many articles written about this, but the idea is you need to
send apache a signal to release the file handle and start writing to the
http://mikkel.hoegh.org/2009/10/08/rotating-apache-httpd-logfiles-freebsd/
-M
Post by Cary
Hi all,
Perhaps someone might be able to help.
The /var/log/httpd-access.log file is turned over at least
once a week on a VPS running 10.2-Stable.
/var/log/httpd-*.log 644 10 500 * GX
is the line I have in /etc/newsyslog.conf.
After doing some more reading I found how the configuration in newsyslog.conf
could be modified to send a signal 30 to the server process.

/var/log/httpd-*.log 644 10 500 * GX /var/run/httpd.pid 30


Thank you for your replies Cody and Markham.


Cary

Loading...