]> git.openstreetmap.org Git - rails.git/commitdiff
Add support for generating logstash friendly logs
authorTom Hughes <tom@compton.nu>
Sun, 19 Jul 2015 18:24:20 +0000 (19:24 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 19 Jul 2015 18:24:20 +0000 (19:24 +0100)
Gemfile
Gemfile.lock
config/application.rb
config/example.application.yml

diff --git a/Gemfile b/Gemfile
index be26c13b57d247d451f9f2bc08b204682fc92cf7..e36912e735f64cacd56eef0a036971db1e4c50c2 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -85,6 +85,9 @@ gem "soap4r-ruby1.9"
 gem "dalli"
 gem "kgio"
 
 gem "dalli"
 gem "kgio"
 
+# Used to generate logstash friendly log files
+gem "logstasher"
+
 # Gems useful for development
 group :development do
   gem "vendorer"
 # Gems useful for development
 group :development do
   gem "vendorer"
index 5e502dd3a0b41c6917aee88b34ee54675a17fc58..341e95ccfede061a02d8674fee71edf1c2b716aa 100644 (file)
@@ -123,6 +123,10 @@ GEM
       tilt
     libv8 (3.16.14.11)
     libxml-ruby (2.8.0)
       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)
     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)
     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)
     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)
   kgio
   konacha
   libxml-ruby (>= 2.0.5)
+  logstasher
   minitest (~> 5.1)
   oauth-plugin (>= 0.5.1)
   omniauth
   minitest (~> 5.1)
   oauth-plugin (>= 0.5.1)
   omniauth
index 48317ec2b8da312dd0f5c7090776b0579300a556..142e436c5162d72d59445cf71d7eae095e1866bf 100644 (file)
@@ -48,5 +48,13 @@ module OpenStreetMap
     if defined?(MEMCACHE_SERVERS)
       config.cache_store = :mem_cache_store, MEMCACHE_SERVERS, { :namespace => "rails:cache" }
     end
     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
   end
 end
index 0af929e7659a0190720ee27a577024677957c982..7435fea89a052d39be95d26c32a992f94cba3454 100644 (file)
@@ -63,6 +63,8 @@ defaults: &defaults
   attachments_dir: ":rails_root/public/attachments"
   # Log file to use
   #log_path: ""
   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
   # List of memcache servers to use for caching
   #memcache_servers: []
   # Enable legacy OAuth 1.0 support