lib/remote_syslog/cli.rb in remote_syslog-1.3.1 vs lib/remote_syslog/cli.rb in remote_syslog-1.4.0
- old
+ new
@@ -102,18 +102,18 @@
@dest_host ||= 'logs.papertrailapp.com'
@dest_port ||= 514
if @files.empty?
- puts "No filenames provided and #{@configfile} not found."
+ puts "No filenames provided and #{@configfile} not found or malformed."
puts ''
puts op
exit
end
# handle relative paths before Daemonize changes the wd to / and expand wildcards
- @files = @files.map { |f| Dir.glob(f) }.flatten.map { |f| File.expand_path(f) }.uniq
+ @files = @files.flatten.map { |f| File.expand_path(f) }.uniq
end
def parse_config
if File.exist?(@configfile)
@@ -159,11 +159,15 @@
connection = UdpEndpoint.new(@dest_host, @dest_port)
end
@files.each do |path|
begin
- EventMachine::file_tail(path, RemoteSyslog::Reader,
+ glob_check_interval = 60
+ exclude_files = []
+
+ EventMachine::FileGlobWatchTail.new(path, RemoteSyslog::Reader,
+ glob_check_interval, exclude_files,
@dest_host, @dest_port,
:socket => connection, :facility => @facility,
:severity => @severity, :strip_color => @strip_color,
:hostname => @hostname, :parse_fields => @parse_fields)
rescue Errno::ENOENT => e
@@ -171,6 +175,6 @@
end
end
end
end
end
-end
\ No newline at end of file
+end