unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: David Nghiem <david@zendesk.com>
Cc: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: [PATCH] add examples/logrotate.conf
Date: Tue, 29 Mar 2011 09:54:58 -0700	[thread overview]
Message-ID: <20110329165458.GA14389@dcvr.yhbt.net> (raw)
In-Reply-To: <20110329162444.GA12293@dcvr.yhbt.net>

Eric Wong <normalperson@yhbt.net> wrote:
> That could be it.   logrotate (without the scary/expensive
> "copytruncate" option) works very quickly for individual files.  Do you
> have the "sharedscripts" option in logrotate enabled?  You should enable
> "sharedscripts"

I actually went with lastaction in my example (I keep forgetting it over
the years and going to postrotate + sharedscripts for some reason..)

> I should post a logrotate example config so other users don't run into
> the same problem...

http://unicorn.bogomips.org/examples/logrotate.conf and pushed
this out to unicorn.git

>From c1ebb313735a280582d87c1ba44619aa47e00b06 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Tue, 29 Mar 2011 09:47:26 -0700
Subject: [PATCH] add examples/logrotate.conf

logrotate is the de facto tool for logrotation, so an
example config for highlighting important parts are in order.

Since our USR1 signal handling is part of the crusade against
the slow and lossy "copytruncate" option, be sure to
emphasize that :)
---
 examples/logrotate.conf |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
 create mode 100644 examples/logrotate.conf

diff --git a/examples/logrotate.conf b/examples/logrotate.conf
new file mode 100644
index 0000000..03fefc6
--- /dev/null
+++ b/examples/logrotate.conf
@@ -0,0 +1,29 @@
+# example logrotate config file, I usually keep this in
+# /etc/logrotate.d/unicorn_app on my Debian systems
+#
+# See the logrotate(8) manpage for more information:
+#    http://linux.die.net/man/8/logrotate
+
+# Modify the following glob to match the logfiles your app writes to:
+/var/log/unicorn_app/*.log {
+	# this first block is mostly just personal preference, though
+	# I wish logrotate offered an "hourly" option...
+	daily
+	missingok
+	rotate 180
+	compress # must use with delaycompress below
+	dateext
+
+	# this is important if using "compress" since we need to call
+	# the "lastaction" script below before compressing:
+	delaycompress
+
+	# note the lack of the evil "copytruncate" option in this
+	# config.  Unicorn supports the USR1 signal and we send it
+	# as our "lastaction" action:
+	lastaction
+		# assuming your pid file is in /var/run/unicorn_app/pid
+		pid=/var/run/unicorn_app/pid
+		test -s $pid && kill -USR1 "$(cat $pid)"
+	endscript
+}
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


      reply	other threads:[~2011-03-29 17:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 19:19 unicorn 1.1.x never-ending listen loop IOError exceptions David Nghiem
2011-03-22 21:39 ` Eric Wong
2011-03-23  0:04   ` David Nghiem
2011-03-23  1:09     ` Eric Wong
     [not found]       ` <AANLkTim3xZMKxcmQzPjcB7vrJKiHoc2f8WoU8RatrDum@mail.gmail.com>
2011-03-29 16:24         ` Eric Wong
2011-03-29 16:54           ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110329165458.GA14389@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=david@zendesk.com \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).