syslog-ngã§railsã®ãã°ãéç´ããæ¹æ³ã«ã¤ãã¦
Sysloggerã®ã¤ã³ã¹ãã¼ã«
Sysloggerãã¤ã³ã¹ãã¼ã«ããã
sudo gem install SyslogLogger
railså´ã®è¨å®
config/environments/production.rb
以ä¸ã追è¨ããã
require 'syslog_logger' RAILS_DEFAULT_LOGGER = SyslogLogger.new "appname"
config/environment.rb
以ä¸ã追è¨ããã
RAILS_DEFAULT_LOGGER ||= Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log")
syslog-ngã®è¨å®
/opt/syslog-ng/etc/syslog-ng.conf
以ä¸ã追è¨ããã
destination d_rails_local { file("/var/log/appname.rails.production.${YEAR}${MONTH}${DAY}.log"); }; filter f_rails_log { program("appname.*"); }; log { source(s_local); filter(f_rails_log); destination(d_rails_local); };
åè
http://seattlerb.rubyforge.org/SyslogLogger/classes/SyslogLogger.html
Railsアプリケーションのログをsyslogに記録する方法 - Hello, world! - s21g
ç°å¢
$ ruby -v ruby 1.8.6 (2009-03-31 patchlevel 368) [i686-linux] $ rails -v Rails 1.0.0 $ cat /etc/redhat-release CentOS release 5 (Final) SyslogLogger (1.4.0) SyslogLogger is a Logger replacement that logs to syslog. It is almost drop-in with a few caveats.