bin/remote_syslog in remote_syslog-1.0.0 vs bin/remote_syslog in remote_syslog-1.1.0
- old
+ new
@@ -12,22 +12,23 @@
require 'remote_syslog'
def remote_syslog_daemon(args)
options = {
:configfile => '/etc/log_files.yml',
- :dest_host => 'logs.papertrailapp.com',
- :dest_port => 514
+ :dest_host => 'logs.papertrailapp.com',
+ :dest_port => 514
}
daemonize_options = {
- :app_name => File.basename($0) || "remote_syslog",
- :ARGV => ['start'],
- :dir_mode => :system,
- :multiple => false,
- :ontop => false,
- :mode => :exec,
- :backtrace => false,
- :monitor => false
+ :app_name => File.basename($0) || "remote_syslog",
+ :ARGV => ['start'],
+ :dir_mode => :system,
+ :multiple => false,
+ :ontop => false,
+ :mode => :exec,
+ :backtrace => false,
+ :monitor => false,
+ :strip_color => false
}
op = OptionParser.new do |opts|
opts.banner = "Usage: remote_syslog [options] <path to add'l log 1> .. <path to add'l log n>"
opts.separator ''
@@ -59,10 +60,13 @@
daemonize_options[:dir] = v
end
opts.on("-s", "--severity SEVERITY", "Severity (notice)") do |v|
options[:severity] = v.upcase
end
+ opts.on("--strip-color", "Strip color codes") do
+ options[:strip_color] = true
+ end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
@@ -95,12 +99,12 @@
socket = EventMachine.open_datagram_socket('0.0.0.0', 0)
files.each do |path|
begin
EventMachine::file_tail(File.expand_path(path), RemoteSyslog::Reader,
- options[:dest_host], options[:dest_port],
- { :socket => socket, :facility => options[:facility],
- :severity => options[:severity] })
+ options[:dest_host], options[:dest_port],
+ :socket => socket, :facility => options[:facility],
+ :severity => options[:severity], :strip_color => options[:strip_color])
rescue Errno::ENOENT => e
puts "#{File.expand_path(path)} not found, continuing. (#{e.message})"
end
end