Project

General

Profile

Actions

Bug #404

closed

lighttpd chokes on rotating logs

Added by Anonymous over 18 years ago. Updated over 15 years ago.

Status:
Invalid
Priority:
Normal
Category:
mod_accesslog
Target version:
ASK QUESTIONS IN Forums:

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.

-- lightty

Actions #1

Updated by Anonymous over 18 years ago

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?

-- lighttpd-2005

Actions #2

Updated by Anonymous over 18 years ago

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.

-- lightty

Actions #3

Updated by Anonymous over 18 years ago

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.

-- lighttpd-2005

Actions #4

Updated by Anonymous over 18 years ago

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?

-- lightty

Actions #5

Updated by Anonymous over 18 years ago

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.

-- lighttpd-2005

Actions #6

Updated by Anonymous about 17 years ago

Actions #7

Updated by stbuehler about 16 years ago

  • Status changed from New to Fixed
  • Resolution set to invalid
Actions #8

Updated by Anonymous almost 16 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (invalid)

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...

-- danger

Actions #9

Updated by Anonymous almost 16 years ago

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

-- danger

Actions #10

Updated by stbuehler almost 16 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to invalid
Actions #11

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Invalid
Actions

Also available in: Atom