sensu-plugins-logs 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -3
- data/bin/check-log.rb +9 -1
- data/lib/sensu-plugins-logs/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a4097a3245236c405f8d92998311318a1f53d01
|
4
|
+
data.tar.gz: 9ccccf0bc32d1075f035f452d0902caaf58c1b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f755f924a2671f195a5d1f5a1f2122493aee45d2ef83a4ab15dbf1b8e6c571dc8bce31127347fda0830c17cb7a10a9fe1938440c1c6b1a5ab0f7d32b06bc811c
|
7
|
+
data.tar.gz: 72df7a59a23125014c7fa988818e62c7024b0345aa6178fb6226512bd500b6b5f05ce0e2397e995a5eb04a19f21604eb1983f2401bcf74ffb765f056f6a68d1a
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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
|
data/bin/check-log.rb
CHANGED
@@ -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
|
-
|
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
|