remote_syslog 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -204,6 +204,17 @@ then the log message, use parse_fields with this regex:
204
204
  Per-file regexes are not supported. Run multiple instances with different
205
205
  config files.
206
206
 
207
+ ### Excluding lines matching a pattern
208
+
209
+ There may be certain log messages that you do not want to be sent. These may
210
+ repetitive log lines that are "noise" that you might not be able to filter out
211
+ easily from the respective application. To filter these lines, use the
212
+ exclude_patterns with an array or regexes:
213
+
214
+ exclude_patterns:
215
+ - exclude this
216
+ - \d+ things
217
+
207
218
 
208
219
  ## Reporting bugs
209
220
 
@@ -1,7 +1,15 @@
1
1
  # see README - demonstrates all optional arguments and file glob formats
2
- files: [/var/log/httpd/access_log, /opt/misc/*, /some/daemon/**/*.log]
2
+ files:
3
+ - /var/log/httpd/access_log
4
+ - /var/log/httpd/error_log
5
+ - /opt/misc/*.log
6
+ - /var/log/mysqld.log
7
+ - /var/run/mysqld/mysqld-slow.log
3
8
  hostname: www42 # override OS hostname
4
9
  parse_fields: syslog # predefined regex name or double-quoted regex
10
+ exclude_patterns:
11
+ - exclude this
12
+ - \d+ things
5
13
  destination:
6
14
  host: logs.papertrailapp.com
7
15
  port: 12345 # optional, defaults to 514
data/lib/remote_syslog.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module RemoteSyslog
2
- VERSION = "1.5.1"
2
+ VERSION = "1.6.0"
3
3
  end
4
4
 
5
5
  require 'remote_syslog/reader'
@@ -24,6 +24,7 @@ module RemoteSyslog
24
24
 
25
25
  @configfile = '/etc/log_files.yml'
26
26
  @strip_color = false
27
+ @exclude_pattern = nil
27
28
 
28
29
  @daemonize_options = {
29
30
  :ARGV => %w(start),
@@ -140,6 +141,10 @@ module RemoteSyslog
140
141
  if config['parse_fields']
141
142
  @parse_fields = FIELD_REGEXES[config['parse_fields']] || Regexp.new(config['parse_fields'])
142
143
  end
144
+
145
+ if config['exclude_patterns']
146
+ @exclude_pattern = Regexp.new(config['exclude_patterns'].map { |r| "(#{r})" }.join('|'))
147
+ end
143
148
  end
144
149
  end
145
150
 
@@ -176,7 +181,8 @@ module RemoteSyslog
176
181
  @dest_host, @dest_port,
177
182
  :socket => connection, :facility => @facility,
178
183
  :severity => @severity, :strip_color => @strip_color,
179
- :hostname => @hostname, :parse_fields => @parse_fields)
184
+ :hostname => @hostname, :parse_fields => @parse_fields,
185
+ :exclude_pattern => @exclude_pattern)
180
186
  rescue Errno::ENOENT => e
181
187
  puts "#{path} not found, continuing. (#{e.message})"
182
188
  end
@@ -13,6 +13,7 @@ module RemoteSyslog
13
13
 
14
14
  @parse_fields = options[:parse_fields]
15
15
  @strip_color = options[:strip_color]
16
+ @exclude_pattern = options[:exclude_pattern]
16
17
 
17
18
  @socket = options[:socket] || UdpEndpoint.new(destination_address, destination_port)
18
19
 
@@ -45,6 +46,8 @@ module RemoteSyslog
45
46
  end
46
47
 
47
48
  def transmit(message)
49
+ return if @exclude_pattern && message =~ @exclude_pattern
50
+
48
51
  message = message.gsub(COLORED_REGEXP, '') if @strip_color
49
52
 
50
53
  packet = @packet.dup
@@ -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.5.1'
11
+ s.version = '1.6.0'
12
12
  s.date = '2012-01-23'
13
13
  s.rubyforge_project = 'remote_syslog'
14
14
 
metadata CHANGED
@@ -1,99 +1,86 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: remote_syslog
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 5
8
- - 1
9
- version: 1.5.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.6.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Troy Davis
13
9
  - Eric Lindvall
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
-
18
- date: 2012-01-23 00:00:00 -08:00
19
- default_executable: remote_syslog
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
13
+ date: 2012-01-23 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: daemons
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
17
+ requirement: &70314298406760 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
31
23
  type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
34
- name: eventmachine
35
24
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
37
- requirements:
25
+ version_requirements: *70314298406760
26
+ - !ruby/object:Gem::Dependency
27
+ name: eventmachine
28
+ requirement: &70314298406200 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
38
31
  - - ~>
39
- - !ruby/object:Gem::Version
40
- segments:
41
- - 0
42
- - 12
43
- - 10
32
+ - !ruby/object:Gem::Version
44
33
  version: 0.12.10
45
34
  type: :runtime
46
- version_requirements: *id002
47
- - !ruby/object:Gem::Dependency
48
- name: eventmachine-tail
49
35
  prerelease: false
50
- requirement: &id003 !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- segments:
55
- - 0
56
- version: "0"
36
+ version_requirements: *70314298406200
37
+ - !ruby/object:Gem::Dependency
38
+ name: eventmachine-tail
39
+ requirement: &70314298422140 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
57
45
  type: :runtime
58
- version_requirements: *id003
59
- - !ruby/object:Gem::Dependency
60
- name: syslog_protocol
61
46
  prerelease: false
62
- requirement: &id004 !ruby/object:Gem::Requirement
63
- requirements:
47
+ version_requirements: *70314298422140
48
+ - !ruby/object:Gem::Dependency
49
+ name: syslog_protocol
50
+ requirement: &70314298421580 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
64
53
  - - ~>
65
- - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
- - 9
69
- - 1
54
+ - !ruby/object:Gem::Version
70
55
  version: 0.9.1
71
56
  type: :runtime
72
- version_requirements: *id004
73
- - !ruby/object:Gem::Dependency
74
- name: em-resolv-replace
75
57
  prerelease: false
76
- requirement: &id005 !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- version: "0"
58
+ version_requirements: *70314298421580
59
+ - !ruby/object:Gem::Dependency
60
+ name: em-resolv-replace
61
+ requirement: &70314298421160 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
83
67
  type: :runtime
84
- version_requirements: *id005
85
- description: Lightweight daemon to tail one or more log files and transmit UDP syslog messages to a remote syslog host (centralized log aggregation). Generates UDP packets itself instead of depending on a system syslog daemon, so it doesn't affect system-wide logging configuration.
86
- email:
68
+ prerelease: false
69
+ version_requirements: *70314298421160
70
+ description: Lightweight daemon to tail one or more log files and transmit UDP syslog
71
+ messages to a remote syslog host (centralized log aggregation). Generates UDP packets
72
+ itself instead of depending on a system syslog daemon, so it doesn't affect system-wide
73
+ logging configuration.
74
+ email:
87
75
  - troy@sevenscale.com
88
76
  - eric@sevenscale.com
89
- executables:
77
+ executables:
90
78
  - remote_syslog
91
79
  extensions: []
92
-
93
- extra_rdoc_files:
80
+ extra_rdoc_files:
94
81
  - README.md
95
82
  - LICENSE
96
- files:
83
+ files:
97
84
  - Gemfile
98
85
  - LICENSE
99
86
  - README.md
@@ -110,35 +97,30 @@ files:
110
97
  - lib/remote_syslog/tls_endpoint.rb
111
98
  - lib/remote_syslog/udp_endpoint.rb
112
99
  - remote_syslog.gemspec
113
- has_rdoc: true
114
100
  homepage: http://github.com/papertrail/remote_syslog
115
101
  licenses: []
116
-
117
102
  post_install_message:
118
- rdoc_options:
103
+ rdoc_options:
119
104
  - --charset=UTF-8
120
- require_paths:
105
+ require_paths:
121
106
  - lib
122
- required_ruby_version: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- segments:
127
- - 0
128
- version: "0"
129
- required_rubygems_version: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- segments:
134
- - 0
135
- version: "0"
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
136
119
  requirements: []
137
-
138
120
  rubyforge_project: remote_syslog
139
- rubygems_version: 1.3.6
121
+ rubygems_version: 1.8.7
140
122
  signing_key:
141
123
  specification_version: 2
142
- summary: Monitor plain text log file(s) for new entries and send to remote syslog collector
124
+ summary: Monitor plain text log file(s) for new entries and send to remote syslog
125
+ collector
143
126
  test_files: []
144
-