# OT: Problem rotating logs with lighttpd

**URL:** <https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472>\
**Category:** Rails\
**Created:** [January 23, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472 "2006-01-23T17:44:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 23, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/1 "2006-01-23T17:44:16Z")

</div>

Hi everybody,

this is a little OT. We are using Lighttpd as a webserver for Rails.  
Our problem is that when we rotate the logs everyday at the end of the  
process, lighttpd stops writing the logs. To solve this we have to  
restart the server manually each time.

We use a common Debian, lighttpd-1.4.7, Rails 1.0 and fcgi-2.4.0.

I have tracked the lighttpd bugs, and I haven’t found anything.

Any suggestion or personal experience?

–  
Fernando B.

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 23, 2006, 6:02pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/2 "2006-01-23T18:02:35Z")

</div>

Fernando B. wrote:

> Any suggestion or personal experience?

It’s not something I’ve come across personally, but this seems relevant:

[http://article.gmane.org/gmane.comp.web.lighttpd/3211](http://article.gmane.org/gmane.comp.web.lighttpd/3211)

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 23, 2006, 7:43pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/3 "2006-01-23T19:43:24Z")

</div>

On Jan 23, 2006, at 1:49 AM, Fernando B. wrote:

> Any suggestion or personal experience?
> 
> –
> 
> Fernando B.
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

Fernando-

```
The way I get around this is a custom script that first copies the

```

log file to a backup dir and tar.gzips it. And then instead of  
deleting the log and making a new on, all I do is this:

$ echo ‘’ \> lighttpd\_access.log

```
That way the same log file gets used but you just make it empty

```

instead of replacing it.

Cheers-  
-Ezra Z.  
Yakima Herald-Republic  
WebMaster  
[http://yakimaherald.com](http://yakimaherald.com)  
509-577-7732  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 23, 2006, 8:10pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/4 "2006-01-23T20:10:47Z")

</div>

I installed lighttpd using a debian package from here:

[http://apt.utsl.gen.nz/debian/pool/sarge-i386/lighttpd\_1.4.5-1\_i386.deb](http://apt.utsl.gen.nz/debian/pool/sarge-i386/lighttpd_1.4.5-1_i386.deb)

(Suggested by the great folks at Rimu Hosting).

This installs lighttpd consistent with debian standards. So, log rotate  
runs  
and rotates the logs just fine.

-Kelly

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 23, 2006, 8:22pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/5 "2006-01-23T20:22:58Z")

</div>

Thanks for your answers (and sorry for my English).

Tomorrow we’ll test that and I’ll tell you if it works 🙂

2006/1/23, Kelly Dwight F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> -Kelly
> 
> > > Our problem is that when we rotate the logs everyday at the end of the
> > 
> > log file to a backup dir and tar.gzips it. And then instead of  
> > Yakima Herald-Republic  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Fernando B.

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 23, 2006, 9:10pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/6 "2006-01-23T21:10:50Z")

</div>

Ezra Z. wrote:

> The way I get around this is a custom script that first copies the  
> log file to a backup dir and tar.gzips it. And then instead of  
> deleting the log and making a new on, all I do is this:
> 
> $ echo ‘’ \> lighttpd\_access.log
> 
> That way the same log file gets used but you just make it empty  
> instead of replacing it.

Is there a way to do that without fear of losing lines placed in the log  
since the copy? Granted at 2 AM there probably wouldn’t be many (except  
for robots).

csn

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 23, 2006, 8:35pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/7 "2006-01-23T20:35:09Z")

</div>

There is a more current lighttpd.deb file that bougyman maintains.  
Last time I checked it was at version 1.4.8 and includes all the  
debian specific stuff. Just do the follwing:

$ sudo echo “deb [http://debian.bougyman.com](http://debian.bougyman.com) unstable main” \>\> /etc/  
apt/sources.list  
$ sudo apt-get update  
$ sudo apt-get install lighttpd

Cheers-  
-Ezra

On Jan 23, 2006, at 11:09 AM, Kelly Dwight F. wrote:

> > restart the server manually each time.
> > 
> > * * *
> 
> deleting the log and making a new on, all I do is this:  
> Yakima Herald-Republic  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

-Ezra Z.  
Yakima Herald-Republic  
WebMaster  
[http://yakimaherald.com](http://yakimaherald.com)  
509-577-7732  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [February 14, 2006, 8:28am UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/8 "2006-02-14T08:28:27Z")

</div>

After some days I come back with this topic again, because I have  
found this two links:

> **[Bug #404: lighttpd chokes on rotating logs - Lighttpd - lighty labs](https://redmine.lighttpd.net/issues/404)**
>
> Redmine

> **[MigratingFromApache - Lighttpd - lighty labs](https://redmine.lighttpd.net/projects/lighttpd/wiki/MigratingFromApache)**
>
> Redmine

So, maybe the problem is that Lighttpd doesn’t handle the SIGHUP  
signal, so it stops writting the logs and, maybe, the solution is to  
use the lighttpd Debian package or use cronolog instead of logrotate.

2006/1/29, Fernando [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > Cheers-  
> > removed\_email\_address@domain.invalid  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Fernando B.

---

<div class="post-metadata">

**Author:** ![ferblape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/73ab20/32.png) [@ferblape](https://www.ruby-forum.com/u/ferblape)\
**Post date:** [January 29, 2006, 3:21pm UTC](https://www.ruby-forum.com/t/ot-problem-rotating-logs-with-lighttpd/64472/9 "2006-01-29T15:21:03Z")

</div>

Ezra Z. wrote:

> There is a more current lighttpd.deb file that bougyman maintains.  
> Last time I checked it was at version 1.4.8 and includes all the  
> debian specific stuff. Just do the follwing:
> 
> $ sudo echo “deb [http://debian.bougyman.com](http://debian.bougyman.com) unstable main” \>\> /etc/  
> apt/sources.list  
> $ sudo apt-get update  
> $ sudo apt-get install lighttpd
> 
> Cheers-  
> -Ezra

We’ll try that version.

Now, the problem begins after the logrotate rotates the logs.
