Giter Club home page Giter Club logo

moonshine_syslog_ng's Introduction

Moonshine syslog-ng

A plugin for Moonshine

A plugin and recipe for installing and managing syslog_ng.

In addition, there are recipes included to setup a centralized log server for your application servers, and a recipe to setup application servers to log to the centralized log server.

Instructions

  • script/plugin install git://github.com/railsmachine/moonshine_syslog_ng.git
  • Include the plugin in your Moonshine manifest plugin :syslog_ng
  • Choose one of the following syslog_ng recipes, explained below

syslog_ng

This is the base syslog_ng recipe. It is responsible for installing the package, and setting it up with some reasonable configuration, and starting it as a service. There are a few things you can configure here.

First is :options. These are the options section of /etc/syslog-ng/syslog-ng.conf. If you don't specificy anything, the Ubuntu defaults are used.

Second is :extra. This is an extra configuration to append to the end of /etc/syslog-ng/syslog-ng.conf.

Example usage:

# Using configure
configure :syslog_ng => {
            :options => {
              :chain_hostnames => 'off',
              :long_hostnames => 'on',
              :use_fqdn => 'on',
              :sync => 0,
              :stats => 43200,
              :log_msg_size => 1048576
          },
          :extra => '# my extra configuration here'
        }
plugin :syslog_ng
recipe :syslog_ng

# Or using moonshine.yml:
:syslog_ng:
  :options:
    # note, it is important to quote on, off, yes, and no, as YAML will try to coerce those to booleans (true and false)
    :chain_hostnames: 'off' 
:long_hostnames: 'on'
:use_fqdn: 'on'
:sync: 0
:stats: 43200
:log_msg_size: 1048576
# With corresponding manifest:
plugin :syslog_ng
recipe :syslog_ng

syslog_ng_centralized_log_server

This uses the underlying syslog_ng recipe to setup the host as a centralized log server ready to receive logs from hosts setup with syslog_ng_rails_client

This will save rails logs to /var/log/rails/rails-application-environment.log and passenger logs to /var/log/rails/passenger.log.

If you need log rotation, you can use logrotate to handle this for you.

You need to provide additional configuration with the IP address of the log server and a port to listen on:

# moonshine.yml, note this isn't under the syslog_ng namespace
:syslog_ng:
  :log_server_ip: 555.555.555.555
  :log_server_port: 515

This sets some :options and uses the :extra. If you need more customization, it probably would make sense to create a new recipe based on it with whatever options and extra configuration you need.

syslog_ng_rails_client

This uses the underlying syslog_ng recipe to setup the host to send rails logs to a host setup with syslog_ng_centralized_log_server.

For this to catch Apache logging for the passenger vhost, the recipe must be declared BEFORE the passenger recipe (ie :default_stack)

You need to provide additional configuration with the IP address of the log server and a port to listen on:

# moonshine.yml, note this isn't under the syslog_ng namespace
:syslog_ng:
  :log_server_ip: 555.555.555.555
  :log_server_port: 515

This sets some :options and uses the :extra. If you need more customization, it probably would make sense to create a new recipe based on it with whatever options and extra configuration you need.

In addition to the updates to the manifest, you need to configure Rails to use the syslog instead of its own logger.

# Gemfile if using Rails 3+ or Rails 2.3 with bundler
gem 'SyslogLogger', :require => false

# config/environment.rb if using Rails 2.3
config.gem 'SyslogLogger', :lib => false

# config/environments/production.rb
require 'syslog/logger' 
# having the name start with rails- is required for the centralized logging to work
config.logger = Syslog::Logger.new("rails-production")

Unless otherwise specified, all content copyright © 2014, Rails Machine, LLC

moonshine_syslog_ng's People

Contributors

ches avatar jnewland avatar queso avatar technicalpickles avatar tgraham avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.