From: Tom Hughes Date: Sun, 19 Jul 2015 18:24:20 +0000 (+0100) Subject: Add support for generating logstash friendly logs X-Git-Tag: live~4054 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/82cefb5929ad2d3945da43040279626336e44ee6?hp=29e364d5856ebd465936c1afadd8c2da2c35b468 Add support for generating logstash friendly logs --- diff --git a/Gemfile b/Gemfile index be26c13b5..e36912e73 100644 --- a/Gemfile +++ b/Gemfile @@ -85,6 +85,9 @@ gem "soap4r-ruby1.9" gem "dalli" gem "kgio" +# Used to generate logstash friendly log files +gem "logstasher" + # Gems useful for development group :development do gem "vendorer" diff --git a/Gemfile.lock b/Gemfile.lock index 5e502dd3a..341e95ccf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -123,6 +123,10 @@ GEM tilt libv8 (3.16.14.11) libxml-ruby (2.8.0) + logstash-event (1.2.02) + logstasher (0.6.5) + logstash-event (~> 1.2.0) + request_store loofah (2.0.2) nokogiri (>= 1.5.9) mail (2.6.3) @@ -225,6 +229,7 @@ GEM rake (10.4.2) redcarpet (3.3.2) ref (2.0.0) + request_store (1.2.0) rest-client (1.8.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 3.0) @@ -317,6 +322,7 @@ DEPENDENCIES kgio konacha libxml-ruby (>= 2.0.5) + logstasher minitest (~> 5.1) oauth-plugin (>= 0.5.1) omniauth diff --git a/config/application.rb b/config/application.rb index 48317ec2b..142e436c5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -48,5 +48,13 @@ module OpenStreetMap if defined?(MEMCACHE_SERVERS) config.cache_store = :mem_cache_store, MEMCACHE_SERVERS, { :namespace => "rails:cache" } end + + # Use logstash for logging if required + if defined?(LOGSTASH_PATH) + config.logstasher.enabled = true + config.logstasher.suppress_app_log = false + config.logstasher.logger_path = LOGSTASH_PATH + config.logstasher.log_controller_parameters = true + end end end diff --git a/config/example.application.yml b/config/example.application.yml index 0af929e76..7435fea89 100644 --- a/config/example.application.yml +++ b/config/example.application.yml @@ -63,6 +63,8 @@ defaults: &defaults attachments_dir: ":rails_root/public/attachments" # Log file to use #log_path: "" + # Log file to use for logstash + #logstash_path: "" # List of memcache servers to use for caching #memcache_servers: [] # Enable legacy OAuth 1.0 support