lib/remote_syslog/cli.rb in remote_syslog-1.5.1 vs lib/remote_syslog/cli.rb in remote_syslog-1.6.0
- old
+ new
@@ -22,10 +22,11 @@
@app_name = File.basename($0) || 'remote_syslog'
@configfile = '/etc/log_files.yml'
@strip_color = false
+ @exclude_pattern = nil
@daemonize_options = {
:ARGV => %w(start),
:dir_mode => :system,
:backtrace => false,
@@ -138,10 +139,14 @@
@client_private_key = config['ssl_client_private_key']
if config['parse_fields']
@parse_fields = FIELD_REGEXES[config['parse_fields']] || Regexp.new(config['parse_fields'])
end
+
+ if config['exclude_patterns']
+ @exclude_pattern = Regexp.new(config['exclude_patterns'].map { |r| "(#{r})" }.join('|'))
+ end
end
end
def run
puts "Watching #{@files.length} files/paths. Sending to #{@dest_host}:#{@dest_port} (#{@tls ? 'TCP/TLS' : 'UDP'})."
@@ -174,10 +179,11 @@
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)
+ :hostname => @hostname, :parse_fields => @parse_fields,
+ :exclude_pattern => @exclude_pattern)
rescue Errno::ENOENT => e
puts "#{path} not found, continuing. (#{e.message})"
end
end
end