sensu-plugins-logs 1.1.2 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65e160084e8cadd546a60d41bf28748123ddd4d8
4
- data.tar.gz: b04f9938db78c391d666a4e54a405f165634c5a8
3
+ metadata.gz: dc78ada8b9f897dae9b51a55d3c873e71a515d02
4
+ data.tar.gz: 2e5dbf9fbf489a095909d34aa2ab60bef47d864e
5
5
  SHA512:
6
- metadata.gz: a975a1d9f454ca8c8614e0182c9cf1fba7325ef0b964d2e4f442c874ff518830e22a33b710ee2b0a398645d7090da3eea7dfee3d9ec70de281927686bc763e68
7
- data.tar.gz: 262801e029c6aa4c90f8e7440e2a957b90f3b756962090eae8efa420cf46a422b3a16bdfdaab1a5eb3da9ee56211e7264bd0cc91b14f271894b7112885d28100
6
+ metadata.gz: 6a5f8e25baca314d153abbb8244f7f4bef3cd177b45c91c611e9ddd9768a171910e03ab6633e7e41d877979edca1cb7f450740467fe46a8eaf4cef60dff07036
7
+ data.tar.gz: d29c4f93e6208ffad9e00b140f00fbfb4827b842da272cb1c06f03fc83beac76ef4253355a3b31e98f101c9c0d4a6935981b5744ce76b586445fc1f4926f45dd
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+
8
+ ## [1.2.0] - 2017-07-04
9
+ ### Added
10
+ - Support of UTF16 encoded characters (@avoosh)
11
+
7
12
  ## [1.1.2] - 2017-05-25
8
13
  ### Fixed
9
14
  - Write the state file atomically by using flock where available (@nlopes)
@@ -48,7 +53,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
48
53
  ### Added
49
54
  - initial release
50
55
 
51
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.2...HEAD
56
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.2.0...HEAD
57
+ [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.2.2...1.2.0
52
58
  [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.1...1.1.2
53
59
  [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.0...1.1.1
54
60
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.0.0...1.1.0
data/bin/check-log.rb CHANGED
@@ -128,6 +128,15 @@ class CheckLog < Sensu::Plugin::Check::CLI
128
128
  proc: proc(&:to_i),
129
129
  default: 250
130
130
 
131
+ # Use this option when you expecting your log lines to contain invalid byte sequence in utf-8.
132
+ # https://github.com/sensu-plugins/sensu-plugins-logs/pull/26
133
+ option :encode_utf16,
134
+ description: 'Encode line with utf16 before matching',
135
+ short: '-eu',
136
+ long: '--encode-utf16',
137
+ boolean: true,
138
+ default: false
139
+
131
140
  def run
132
141
  unknown 'No log file specified' unless config[:log_file] || config[:file_pattern]
133
142
  unknown 'No pattern specified' unless config[:pattern]
@@ -208,6 +217,10 @@ class CheckLog < Sensu::Plugin::Check::CLI
208
217
  line = get_log_entry(line)
209
218
  end
210
219
 
220
+ if config[:encode_utf16]
221
+ line = line.encode('UTF-16', invalid: :replace, replace: '')
222
+ end
223
+
211
224
  line = line.encode('UTF-8', invalid: :replace, replace: '')
212
225
  bytes_read += line.bytesize
213
226
  if config[:case_insensitive]
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsLogs
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
5
- PATCH = 2
4
+ MINOR = 2
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin