From: Eric Wong <firstname.lastname@example.org>
To: "Dowd, Stephen" <email@example.com>
Subject: Re: Question: How to limit size of log & error files
Date: Fri, 24 Jul 2015 17:13:56 +0000 [thread overview]
Message-ID: <20150724171356.GA24235@dcvr.yhbt.net> (raw)
"Dowd, Stephen" <firstname.lastname@example.org> wrote:
> I'd like to control the size and on disk layout of the unicorn error
> and output logs. Basically I want ruby Logger like functionality
> where I can specify a fixed # of rolling logs each of which is limited
> to # mb in size. Not sure how to do this in unicorn.rb.
You can also use the "logger" directive to avoid using the default
Logger (which goes to $stderr) instead:
You'll also need to reconfigure Rack::CommonLogger and/or whatever
logger your framework (e.g. Rails/Sinatra) uses.
In modern versions of Ruby, the Logger class also seems multi-process
aware when doing its internal logrotation.
There is also SyslogLogger RubyGem which provides a Logger interface but
goes directly to syslog.
> My unicorn.conf file has basically the defaults, with the exception of:
> Stderr_path "/log/unicorn/stderr.log"
> Stdout_path "/log/unicorn/stdout.log"
> These files will grow to the point where the disk becomes full at
> which point we begin to see failures.
I prefer to log to files and use logrotate using a config as in
http://unicorn.bogomips.org/examples/logrotate.conf as Ben pointed out.
But you can also point those to FIFO + chronolog as Hleb pointed out,
too. That might be a little slower because of the context switches
and synchronous wakeups.
prev parent reply other threads:[~2015-07-24 17:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 13:54 Question: How to limit size of log & error files Dowd, Stephen
2015-07-24 14:05 ` Ben Lovell
2015-07-24 14:28 ` Hleb Valoshka
2015-07-24 17:13 ` Eric Wong [this message]
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:
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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
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).