The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
#yerdoinitwrong episode 1: logging with syslog

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Bryan Liles

Posts: 228
Nickname: bryanl
Registered: May, 2008

Bryan Liles is the Principal Web Developer for Sourcefire, Inc.
#yerdoinitwrong episode 1: logging with syslog Posted: Sep 16, 2009 7:49 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Bryan Liles.
Original Post: #yerdoinitwrong episode 1: logging with syslog
Feed Title: Smarticus
Feed URL: http://smartic.us/feed/atom.xml
Feed Description: Ramblings of a ruby hacker
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Bryan Liles
Latest Posts From Smarticus

Advertisement

We always give all of our best work to development. We create code we are proud to attach our name to, and then we throw it on production. When it gets to production, there are going to problems, and the first thing you are going to do is head to your logs. So why aren’t we taking more steps to have easier accessible logs?

Log management in Ruby on Rails isn’t very good out of the box. When your application starts getting any level of decent traffic, tailing the log isn’t very effective. Searching the log is even harder, and correlating data is pretty much out of the question. The good thing is that is pretty much a solved problem, so let’s review one potential solution.

With Ruby on Rails, you can easily swap our your logger. So instead of the instead of the standard Ruby logger, we’re going to swap in SyslogLogger gem from seattle.rb. Once you have either installed the gem or configured Ruby on Rails to install the gem, you can configure it in your environment.rb. (or one of your environment specific configuration files)

RAILS_DEFAULT_LOGGER = SyslogLogger.new
Rails::Initializer.run do |config|
  ...
  config.logger = RAILS_DEFAULT_LOGGER
end

Now Rails will send the logs to syslog. Next, you’ll want to configure syslog to send all your logs to a remote server we’ll talk about later

*.*	@remote.server

Make sure to restart your syslog server after making these changes.

Now why would we want to send out logs to a remote server? Because central log management is the bees knees of course.

When it comes to log management, nothing beats Splunk. Nothing. So that means we should send our logs to our Splunk server. The Splunk guides make configuring this easy, and their documentation is superb.

Now that you have Splunk configured, you should be receiving logs. The amount of options it gives you is absolutely breath taking, so I advise you to spend some time learning it.

Now if I’m doing it wrong let me know in the comments. Word.

Read: #yerdoinitwrong episode 1: logging with syslog

Topic: Quicksort in 5 minutes Previous Topic   Next Topic Topic: Moving from Blogger to Wordpress

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use