Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated for Rails 3

  • Loading branch information...
commit 2b1a87c3c61805bfa235c82ea8660fdf808cafa3 1 parent 885f3b2
dewski authored
1  .gitignore
View
@@ -0,0 +1 @@
+config.yaml
105 config.yaml
View
@@ -1,105 +0,0 @@
-servers:
- site1:
- host: foobar.com
- user: foo
- password: topsecret
- command: tail -f -n0
- files: /var/log/apache/access_log
- parser: apache
- color: 0.2, 1.0, 0.2, 1.0
- rails:
- gateway: gw-server.anotherfunsite.com
- host: anotherfunsite.com
- user: anotherfunuser
- port: 222
- command: tail -f -n0
- files: /var/www/apps/funapp/current/log/production.log
- parser: rails
- color: 0.2, 0.2, 1.0, 1.0
-config:
- dimensions: 1200x600
- min_blob_size: 0.004
- max_blob_size: 0.04
- highlight_color: orange
- bounce: false
- left_column:
- size: 25
- alignment: -0.99
- blocks:
- info:
- order: 0
- size: 10
- auto_clean: false
- show: total
- hosts:
- order: 1
- size: 3
- sites:
- order: 2
- size: 10
- content:
- order: 3
- size: 5
- show: total
- color: 1.0, 0.8, 0.4, 1.0
- status:
- order: 4
- size: 10
- color: 1.0, 0.8, 0.4, 1.0
- types:
- order: 5
- size: 5
- color: 1.0, 0.4, 0.2, 1.0
- users:
- order: 6
- size: 10
- smtp:
- order: 7
- size: 5
- logins:
- order: 8
- size: 5
- database:
- order: 9
- size: 10
- memcached:
- order: 10
- size: 3
-
- right_column:
- size: 25
- alignment: 0.99
- blocks:
- urls:
- order: 0
- size: 15
- slow requests:
- order: 1
- size: 5
- show: average
- referrers:
- order: 2
- size: 10
- user agents:
- order: 3
- size: 5
- color: 1.0, 1.0, 1.0, 1.0
- mail from:
- order: 4
- size: 5
- mail to:
- order: 5
- size: 5
- viruses:
- order: 6
- size: 5
- rejections:
- order: 7
- size: 5
- color: 1.0, 0.2, 0.2, 1.0
- warnings:
- order: 8
- size: 5
-resolver:
- reverse_ip_lookups: true
- reverse_timeout: 0.5
12 lib/gl_tail/parsers/memcached.rb
View
@@ -8,14 +8,8 @@
# Brilliant format design and code by Magnus Holm <judofyr>
class MemcachedParser < Parser
def parse( line )
- hits, miss = line.split(" & ").map { |x| x.to_i }
-
- hits.times do
- add_activity(:block => 'memcached', :name => 'hit', :color => [0.0, 1.0, 0.0, 1.0])
- end
-
- miss.times do
- add_activity(:block => 'memcached', :name => 'miss', :color => [1.0, 0.0, 0.0, 1.0])
- end
+ add_activity(:block => 'memcached', :name => 'hit', :color => [0.0, 1.0, 0.0, 1.0]) if line.include?('get ')
+ add_activity(:block => 'memcached', :name => 'store', :color => [0.0, 1.0, 0.0, 1.0]) if line.include?('store ')
+ add_activity(:block => 'memcached', :name => 'set', :color => [0.0, 1.0, 0.0, 1.0]) if line.include?('set ')
end
end
4 lib/gl_tail/parsers/nginx.rb
View
@@ -39,8 +39,8 @@ def parse( line )
add_activity(:block => 'content', :name => type)
add_activity(:block => 'status', :name => status, :type => 3)
- add_event(:block => 'info', :name => "Logins", :message => "Login...", :update_stats => true, :color => [1.5, 1.0, 0.5, 1.0]) if method == "POST" && url.include?('/login')
- add_event(:block => 'info', :name => "Registration", :message => "Register", :update_stats => true, :color => [1.5, 0.0, 0.0, 1.0]) if method == "POST" && url.include?('/register')
+ add_event(:block => 'info', :name => "Logins", :message => "Login...", :update_stats => true, :color => [1.5, 1.0, 0.5, 1.0]) if method == "POST" && url.include?('/users/login')
+ add_event(:block => 'info', :name => "Registration", :message => "Register", :update_stats => true, :color => [1.5, 0.0, 0.0, 1.0]) if method == "POST" && url.include?('/users/signup')
end
end
end
35 lib/gl_tail/parsers/rails.rb
View
@@ -7,42 +7,27 @@
# Parser which handles Rails access logs
class RailsParser < Parser
def parse( line )
- #Completed in 0.02100 (47 reqs/sec) | Rendering: 0.01374 (65%) | DB: 0.00570 (27%) | 200 OK [http://example.com/whatever/whatever]
- if matchdata = /^Completed in ([\d.]+) .* \[([^\]]+)\]/.match(line)
- _, ms, url = matchdata.to_a
- url = nil if url == "http:// /" # mod_proxy health checks?
- #Rails 2.2.2+: Completed in 17ms (View: 0, DB: 11) | 200 OK [http://example.com/etc/etc]
- elsif matchdata = /^Completed in ([\d]+)ms .* \[([^\]]+)\]/.match(line)
- _, new_ms, url = matchdata.to_a
- ms = new_ms.to_f / 1000
- url = nil if url == "http:// /" # mod_proxy health checks?
+ if matchdata = /^Started (GET|PUT|DELETE|POST) \"([\/A-Za-z0-9\-_]+)\" for (\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)/.match(line)
+ _, method, url, host = matchdata.to_a
end
-
+
if url
- _, host, url = /^http[s]?:\/\/([^\/]*)(.*)/.match(url).to_a
-
- add_activity(:block => 'sites', :name => host, :size => ms.to_f) # Size of activity based on request time.
- add_activity(:block => 'urls', :name => HttpHelper.generalize_url(url), :size => ms.to_f)
- add_activity(:block => 'slow requests', :name => HttpHelper.generalize_url(url), :size => ms.to_f)
add_activity(:block => 'content', :name => 'page')
+ add_activity(:block => 'users', :name => host) if host
+ add_activity(:block => 'method', :name => method) if method
# Events to pop up
- add_event(:block => 'info', :name => "Logins", :message => "Login...", :update_stats => true, :color => [0.5, 1.0, 0.5, 1.0]) if url.include?('/login')
- add_event(:block => 'info', :name => "Sales", :message => "$", :update_stats => true, :color => [1.5, 0.0, 0.0, 1.0]) if url.include?('/checkout')
- add_event(:block => 'info', :name => "Signups", :message => "New User...", :update_stats => true, :color => [1.0, 1.0, 1.0, 1.0]) if(url.include?('/signup') || url.include?('/users/create'))
- elsif line.include?('Processing ')
- #Processing TasksController#update_sheet_info (for 123.123.123.123 at 2007-10-05 22:34:33) [POST]
- _, host = /^Processing .* \(for (\d+.\d+.\d+.\d+) at .*\).*$/.match(line).to_a
- if host
- add_activity(:block => 'users', :name => host)
- end
+ add_event(:block => 'info', :name => "Revisions", :message => "Revision", :update_stats => true, :color => [0.5, 1.0, 0.5, 1.0]) if url.include?('pages') && method == "POST"
+ add_event(:block => 'info', :name => "Attachments", :message => "Attachment", :update_stats => true, :color => [0.5, 1.0, 0.5, 1.0]) if url.include?('attachments') && method == "POST"
+ add_event(:block => 'info', :name => "Logins", :message => "Login...", :update_stats => true, :color => [0.5, 1.0, 0.5, 1.0]) if url.include?('/users/login')
+ add_event(:block => 'info', :name => "Sales", :message => "$", :update_stats => true, :color => [1.5, 0.0, 0.0, 1.0]) if url.include?('/users/checkout')
+ add_event(:block => 'info', :name => "Signups", :message => "New User...", :update_stats => true, :color => [1.0, 1.0, 1.0, 1.0]) if(url.include?('/users/signup') || url.include?('/users/create'))
elsif line.include?('Error (')
_, error, msg = /^([^ ]+Error) \((.*)\):/.match(line).to_a
if error
add_event(:block => 'info', :name => "Exceptions", :message => error, :update_stats => true, :color => [1.0, 0.0, 0.0, 1.0])
add_event(:block => 'info', :name => "Exceptions", :message => msg, :update_stats => false, :color => [1.0, 0.0, 0.0, 1.0])
add_activity(:block => 'warnings', :name => msg)
-
end
end
end
2  lib/gl_tail/sources/ssh.rb
View
@@ -24,7 +24,7 @@ def init
session_options[:keys] = keys if keys
session_options[:verbose] = :debug if $DBG > 1
session_options[:password] = password if password
-
+
begin
if gateway
puts "Connecting via gateway #{gateway}..." if($VRB > 0 || $DBG > 0)
Please sign in to comment.
Something went wrong with that request. Please try again.