unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Question:  How to limit size of log & error files
@ 2015-07-24 13:54 Dowd, Stephen
  2015-07-24 14:05 ` Ben Lovell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dowd, Stephen @ 2015-07-24 13:54 UTC (permalink / raw)
  To: unicorn-public@bogomips.org

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.  

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.   


Thanks in advance...

Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: How to limit size of log & error files
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Ben Lovell @ 2015-07-24 14:05 UTC (permalink / raw)
  To: Dowd, Stephen; +Cc: unicorn-public@bogomips.org

On 24 July 2015 at 14:54, Dowd, Stephen <stephen.dowd@emc.com> 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.
>
> 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.
>
>
> Thanks in advance...
>
> Steve
>

It's right there in the docs:
http://unicorn.bogomips.org/examples/logrotate.conf

Cheers,
Ben


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question: How to limit size of log & error files
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Hleb Valoshka @ 2015-07-24 14:28 UTC (permalink / raw)
  To: unicorn-public

On 7/24/15, Dowd, Stephen <stephen.dowd@emc.com> 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.
>
> My unicorn.conf file has basically the defaults, with the exception of:
>
> Stderr_path "/log/unicorn/stderr.log"
> Stdout_path "/log/unicorn/stdout.log"

Create 2 FIFO and forward to syslog.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question:  How to limit size of log & error files
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2015-07-24 17:13 UTC (permalink / raw)
  To: Dowd, Stephen; +Cc: unicorn-public

"Dowd, Stephen" <stephen.dowd@emc.com> 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:

http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-logger

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-24 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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