sensu-plugins-logs 1.2.1 → 1.3.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: 1255760d5b9cd18ee05eccc9c251683acf42f785
4
- data.tar.gz: 90b5fd4f74d16d4ebae49e3db735c622baf5d96e
3
+ metadata.gz: 3a4097a3245236c405f8d92998311318a1f53d01
4
+ data.tar.gz: 9ccccf0bc32d1075f035f452d0902caaf58c1b58
5
5
  SHA512:
6
- metadata.gz: 38478d5a2d08343171e5593631781340293d14f40f892ba1b6b5847e4968a3b27df184e827c5ef390e3f0d6a721294fea213c81e4e44d2504992000a2933b276
7
- data.tar.gz: 593940bb2a20c07b827044a5f2ea60f79ddbb7ab83c3dc0e53c5a717d0fc6dfed03215d701d61d1f33f65ef81fc784a4f1e382cf08d8b16523bac13a82d8221d
6
+ metadata.gz: f755f924a2671f195a5d1f5a1f2122493aee45d2ef83a4ab15dbf1b8e6c571dc8bce31127347fda0830c17cb7a10a9fe1938440c1c6b1a5ab0f7d32b06bc811c
7
+ data.tar.gz: 72df7a59a23125014c7fa988818e62c7024b0345aa6178fb6226512bd500b6b5f05ce0e2397e995a5eb04a19f21604eb1983f2401bcf74ffb765f056f6a68d1a
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.3.0] - 2017-09-23
9
+ ### Added
10
+ - check-log.rb: `return-error-limit` option to limit the number of returned matched lines (log entries) (@jhshadi)
11
+
8
12
  ## [1.2.1] - 2017-09-23
9
13
  ### Added
10
14
  - ruby 2.4 testing (@majormoses)
@@ -30,8 +34,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
30
34
 
31
35
  ## [1.1.0] - 2017-05-20
32
36
  ### Added
33
- - Add `return-length` option to support custom length for returned matched lines
34
- - Add `log-pattern` option to support read and match against whole log entry instead of single line
37
+ - Add `return-length` option to support custom length for returned matched lines (@jhshadi)
38
+ - Add `log-pattern` option to support read and match against whole log entry instead of single line (@jhshadi)
35
39
 
36
40
  ## [1.0.0] - 2017-03-07
37
41
  ### Fixed
@@ -64,7 +68,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
64
68
  ### Added
65
69
  - initial release
66
70
 
67
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.2.1...HEAD
71
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.3.0...HEAD
72
+ [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.2.1...1.3.0
68
73
  [1.2.1]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.2.0...1.2.1
69
74
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.2.2...1.2.0
70
75
  [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.1.1...1.1.2
@@ -128,6 +128,12 @@ class CheckLog < Sensu::Plugin::Check::CLI
128
128
  proc: proc(&:to_i),
129
129
  default: 250
130
130
 
131
+ option :return_error_limit,
132
+ description: 'Max number of returned matched lines(log entries)',
133
+ short: '-M N',
134
+ long: '--return-error-limit N',
135
+ proc: proc(&:to_i)
136
+
131
137
  # Use this option when you expecting your log lines to contain invalid byte sequence in utf-8.
132
138
  # https://github.com/sensu-plugins/sensu-plugins-logs/pull/26
133
139
  option :encode_utf16,
@@ -225,7 +231,9 @@ class CheckLog < Sensu::Plugin::Check::CLI
225
231
  m = line.match(config[:pattern]) unless line.match(config[:exclude])
226
232
  end
227
233
  if m
228
- accumulative_error += "\n" + line.slice(0..config[:return_content_length])
234
+ if !config[:return_error_limit] || (config[:return_error_limit] && n_matched < config[:return_error_limit])
235
+ accumulative_error += "\n" + line.slice(0..config[:return_content_length])
236
+ end
229
237
  n_matched += 1
230
238
  end
231
239
  end
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsLogs
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 2
5
- PATCH = 1
4
+ MINOR = 3
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors