remote_syslog 1.6.7 → 1.6.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -174,6 +174,17 @@ than the current set of matches). This is not necessary for globs defined in
174
174
  the config file.
175
175
 
176
176
 
177
+ ### Excluding files from being sent
178
+
179
+ Provide one or more regular expressions to prevent certain files from being
180
+ matched.
181
+
182
+ exclude_files:
183
+ - \.\d$
184
+ - .bz2
185
+ - .gz
186
+
187
+
177
188
  ### Multiple instances
178
189
 
179
190
  Run multiple instances to support more than one message-specific file format
@@ -1,4 +1,4 @@
1
1
  module RemoteSyslog
2
- VERSION = "1.6.7"
2
+ VERSION = "1.6.7.1"
3
3
  end
4
4
 
@@ -23,11 +23,17 @@ module RemoteSyslog
23
23
  attr_accessor :facility, :severity, :hostname
24
24
 
25
25
  # Other settings
26
- attr_accessor :strip_color, :parse_fields, :exclude_pattern
26
+ attr_accessor :strip_color, :parse_fields
27
27
 
28
- # Files
28
+ # Exclude messages matching pattern
29
+ attr_accessor :exclude_pattern
30
+
31
+ # Files (can be globs)
29
32
  attr_reader :files
30
33
 
34
+ # Exclude files matching pattern
35
+ attr_accessor :exclude_file_pattern
36
+
31
37
  # How often should we check for new files?
32
38
  attr_accessor :glob_check_interval
33
39
 
@@ -107,7 +113,7 @@ module RemoteSyslog
107
113
 
108
114
  files.each do |file|
109
115
  RemoteSyslog::GlobWatch.new(file, @glob_check_interval,
110
- method(:watch_file))
116
+ @exclude_file_pattern, method(:watch_file))
111
117
  end
112
118
  end
113
119
  end
@@ -228,6 +228,14 @@ module RemoteSyslog
228
228
  if config['exclude_patterns']
229
229
  @agent.exclude_pattern = Regexp.new(config['exclude_patterns'].map { |r| "(#{r})" }.join('|'))
230
230
  end
231
+
232
+ if config['exclude_files']
233
+ @agent.exclude_file_pattern = Regexp.new(config['exclude_files'].map { |r| "(#{r})" }.join('|'))
234
+ end
235
+
236
+ if config['new_file_check_interval']
237
+ @agent.glob_check_interval = config['new_file_check_interval']
238
+ end
231
239
  end
232
240
 
233
241
  def run
@@ -2,12 +2,19 @@ require 'eventmachine-tail'
2
2
 
3
3
  module RemoteSyslog
4
4
  class GlobWatch < EventMachine::FileGlobWatch
5
- def initialize(path, interval, callback)
6
- super(path, interval)
5
+ def initialize(path, interval, exclude_files, callback)
6
+ @exclude_files = exclude_files
7
7
  @callback = callback
8
+
9
+ super(path, interval)
8
10
  end
9
11
 
10
12
  def file_found(path)
13
+ # Check if we should exclude this file
14
+ if @exclude_files && @exclude_files =~ path
15
+ return
16
+ end
17
+
11
18
  @callback.call(path)
12
19
  end
13
20
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  ## If your rubyforge_project name is different, then edit it and comment out
9
9
  ## the sub! line in the Rakefile
10
10
  s.name = 'remote_syslog'
11
- s.version = '1.6.7'
11
+ s.version = '1.6.7.1'
12
12
  s.date = '2012-09-10'
13
13
  s.rubyforge_project = 'remote_syslog'
14
14
 
metadata CHANGED
@@ -6,7 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 1
7
7
  - 6
8
8
  - 7
9
- version: 1.6.7
9
+ - 1
10
+ version: 1.6.7.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Troy Davis