J
J
Jeket2013-12-20 01:05:23
Ruby on Rails
Jeket, 2013-12-20 01:05:23

How to autorotate logs in unicorn?

For the production server, there are unicorn
config/unicorn.rb settings

app_name = "app_name"
root = "/home/my_app"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/unicorn.err.log"
stdout_path "#{root}/log/unicorn.out.log"

listen "/tmp/unicorn.#{app_name}.sock"
worker_processes 2
timeout 30

before_exec do |_|
  ENV["BUNDLE_GEMFILE"] = File.join(root, 'Gemfile')
end

How to limit the size of the log file and overwrite them?
Similar to Rails.logger = Logger.new(Rails.root.join("log",Rails.env + ".log"), 3, 20*1024*1024)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Kolosov, 2014-01-12
@Jeket

unicorn.conf is the config file for logrotate

A
Alexey Kolosov, 2013-12-20
@satisFUCKtor

logrotate?
like this - https://gist.github.com/petey5king/1480137

J
Jeket, 2013-12-20
@Jeket

Is it at the application level? How to include unicorn.conf in a rails application?

J
Jeket, 2014-01-21
@Jeket

Thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question