Ticket #404 (closed defect: invalid)

Opened 2 years ago

Last modified 2 weeks ago

lighttpd chokes on rotating logs

Reported by: lightty@marino.st Assigned to: jan
Priority: normal Milestone: 1.4.19
Component: mod_accesslog Version: 1.4.x-svn
Severity: normal Keywords: log
Cc: Blocking:
Need Feedback: 0

Description

I have two FreeBSD systems that use the newsyslog utility to rotate the access and log files. I have maintained the same name and location as apache 2 (httpd-access.log and httpd-error.log). Once a week, Sunday Midnight, those logs are rotated.

When that happens, lighttpd will no longer write to the log file. newsyslog creates a zero-length file the exact same name as before, but it will not be written to unless lighttpd is restarted.

hopefully the cause of this can be found as it appears that rotating logs can't be used with lighttpd right now.

Attachments

Change History

12/04/2005 10:43:40 PM changed by lighttpd-2005@ryandesign.com

I don't know anything about how newsyslog functions, but that certainly sounds like normal and expected behavior to me. A program light lighttpd will open a log file when it starts and not close it until it quits. If you rename the log file, the software will of course continue writing to it under its new name, and will not attempt to write to a new file of the old name until it starts again.

Perhaps newsyslog is sending a signal to lighttpd to tell it to close and reopen its logfile, and lighttpd is not doing so? Or perhaps newsyslog needs to first be configured to send such a signal?

12/04/2005 10:51:09 PM changed by lightty@marino.st

first, apache2 has no problem writing on a rotated log, so I don't think this is normal behavior. Assume file is named "my.log". All newsyslog does is rename "my.log.1" to "my.log.2", "my.log.0" to "my.log.1", and "my.log" to "my.log.0". Then it creates a new, empty "my.log" file. I would expect lighttpd to continue logging on the newly created 777 permission log file.

I don't think there is any "signals" involved.

newsyslog is used by FreeBSD to rotate several potential large files. I have configured this generic utility to rotate the httpd logs every week.

12/04/2005 11:04:01 PM changed by lighttpd-2005@ryandesign.com

According to this page:

http://www.freebsddiary.org/rotatelogs.php#newsyslog

newsyslog lets you specify a file containing the process ID of the process, and will by default send a SIGHUP to the process to tell it to start over with new log files, though you can specify an alternate signal number. I do not know if lighttpd responds to any signal number, nor if you can tell lighttpd to write its PID into a file at startup time.

12/07/2005 11:55:36 AM changed by lightty@marino.st

okay, thanks, I didn't know that.

However, the fact remains that Apache does response to the SIGHUP, and I think lightty should have the same behavior regarding rotating log files.

Can this ticket be used to add this capability?

12/11/2005 09:45:47 AM changed by lighttpd-2005@ryandesign.com

A Google search for "lighttpd sighup" shows that, according to the documentation, this capability already exists:

http://trac.lighttpd.net/trac/wiki/MigratingFromApache

"logrotate will send lighttpd a SIGHUP when it is time to rotate the logs and lighttpd will reopen the logs accordingly."

I have not yet tried to rotate lighttpd's logs, though I intend to try cronolog for that purpose, as it has served me well with Apache.

And to follow up on my earlier post, yes, you can have lighttpd write its pid to a file by setting the server.pid-file directive in the configuration file.

03/17/2007 03:51:23 PM changed by anonymous

03/03/2008 05:27:28 PM changed by stbuehler

  • status changed from new to closed.
  • resolution set to invalid.
  • blocking changed.
  • pending changed.

05/03/2008 08:23:42 AM changed by danger@rulez.sk

  • status changed from closed to reopened.
  • resolution deleted.

Actually I have configured newsyslog to send a SIGHUP signal to lighttpd when it starts to rotate its logs, however it doesn't help. I think that lighttpd doesn't handle SIGHUP signals correctly, maybe somebody might have a look at this issue? I am open for testing any patches...

05/03/2008 08:36:50 AM changed by danger@rulez.sk

Sorry for the hassle, it works probably fine, I had turned off the logging :-) Please close the ticket.

05/03/2008 10:28:43 AM changed by stbuehler

  • status changed from reopened to closed.
  • resolution set to invalid.

Add/Change #404 (lighttpd chokes on rotating logs)




Change Properties
Action