Skip to content

Centralized Logging

Ben Wyrosdick edited this page Mar 14, 2015 · 5 revisions

Logging to a central server is done through syslog. We are using papertrail to host our logs.

Application Logging

Heroku

heroku drains:add syslog://SUBDOMAIN.papertrailapp.com:PORT

Rails

Add remote_syslog_logger to :production group in Gemfile

Add logger and log level to production.rb

config.logger = RemoteSyslogLogger.new(‘SUBDOMAIN.papertrailapp.com', PORT, program: "rails-#{Rails.application.class.name.split('::').first}")
config.logger.level = Logger::Severity::INFO

Server Logging

As root edit /etc/rsyslog.conf Add the following line:

*.*    @SUBDOMAIN.papertrailapp.com:PORT

once you have added that restart the syslog process

service rsyslog restart

Checking log Log into https://papertrailapp.com Select system Optionally “Create Group” and select a system filter (or systems individually)

Clone this wiki locally