Skip to content
Browse files

- Basic support for creating a new config-file.

  gl_tail --new myconfig
  • Loading branch information...
1 parent 6668a5f commit 415b449781e6b7fbe33eb04c8e5abfc0066734a0 erlends committed Oct 22, 2007
Showing with 124 additions and 2 deletions.
  1. +1 −1 Manifest.txt
  2. +22 −1 bin/gl_tail
  3. +101 −0 dist/config.yaml
View
2 Manifest.txt
@@ -5,7 +5,7 @@ README.txt
Rakefile
TODO
bin/gl_tail
-config.yaml
+dist/config.yaml
lib/gl_tail.rb
lib/gl_tail/activity.rb
lib/gl_tail/blob_store.rb
View
23 bin/gl_tail
@@ -15,6 +15,7 @@ ARGV.each do |arg|
puts "gl_tail.rb [--help|-h] [--parsers|-p] [--verbose|-v] [--debug|-d] [--debug-ssh|-ds] [configfile]",
'[--help|-h] This help screen',
'[--version] Print version information',
+ '[--new|-n] Initialize config specified with default options',
'[--parsers|-p] List available parsers',
'[--options|-o] List available configuration options',
'[--quiet|-q] Turn off runtime information',
@@ -24,6 +25,8 @@ ARGV.each do |arg|
exit
when '-version', '--version'
@print = :version
+ when '-new', '--new', '-n'
+ @init_config = true
when '-parsers','--parsers', '-p'
@print = :parsers
when '-debug', '--debug', '-d'
@@ -35,14 +38,32 @@ ARGV.each do |arg|
when '--options', '-o'
@print = :options
else
- if File.exist? arg
+ if(File.exist?(arg) && File.file?(arg))
file = arg
else
file = "#{arg}.yaml"
end
end
end
+if defined? @init_config
+ require 'ftools'
+
+ if File.directory? file
+ puts "'#{file}' is a directory, not overwriting."
+ exit
+ end
+
+ if File.exist? file
+ File.move(file, file + ".bak")
+ puts "Existing configuration moved to '#{file + '.bak'}'"
+ end
+ File.copy(File.dirname(__FILE__) + '/../dist/config.yaml', file)
+ puts "Example configuration installed in '#{file}'"
+ puts "Please edit and change server and login information."
+ exit
+end
+
require File.dirname(__FILE__) + '/../lib/gl_tail.rb'
if defined? @print
View
101 dist/config.yaml
@@ -0,0 +1,101 @@
+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:
+ 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
+
+ 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

0 comments on commit 415b449

Please sign in to comment.
Something went wrong with that request. Please try again.