fluent-plugin-detect-exceptions-with-error 0.0.1 → 0.0.2a
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 +4 -4
- data/Gemfile.lock +60 -0
- data/README.rdoc +5 -94
- data/fluent-plugin-detect-exceptions-with-error-0.0.2.gem +0 -0
- data/fluent-plugin-detect-exceptions-with-error.gemspec +2 -2
- data/lib/fluent/plugin/exception_detector.rb +4 -4
- data/test/plugin/test_out_detect_exceptions.rb +36 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 709478f4d3cf9404cd6f99da3b8cf8e1f9b8cd35
|
4
|
+
data.tar.gz: fdf9499a67bb8fa7f7922a957800fe7fa58e410d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce8c8665fb2e0803feb588f63df1c8ff045589a9f6fff75edb82d70b21058cdccbfd69201e6ef2c51d4649879c3e674bd26a018abf052be0f911ac6dc44887b6
|
7
|
+
data.tar.gz: 90894b33d49e72df19f9b4e93c5f1c68da857f76087e92e9bac1697cd6a0d1fd6bf350dd145febd67276ff3cc60d62784ebd08435a6e01d1f599995a49b9816e
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fluent-plugin-detect-exceptions-with-error (0.0.2)
|
5
|
+
fluentd (~> 0.10)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.3.0)
|
11
|
+
cool.io (1.4.6)
|
12
|
+
fluentd (0.12.33)
|
13
|
+
cool.io (>= 1.2.2, < 2.0.0)
|
14
|
+
http_parser.rb (>= 0.5.1, < 0.7.0)
|
15
|
+
json (>= 1.4.3)
|
16
|
+
msgpack (>= 0.5.11, < 2)
|
17
|
+
sigdump (~> 0.2.2)
|
18
|
+
string-scrub (>= 0.0.3, <= 0.0.5)
|
19
|
+
tzinfo (>= 1.0.0)
|
20
|
+
tzinfo-data (>= 1.0.0)
|
21
|
+
yajl-ruby (~> 1.0)
|
22
|
+
http_parser.rb (0.6.0)
|
23
|
+
json (2.0.3)
|
24
|
+
msgpack (1.1.0)
|
25
|
+
parser (2.4.0.0)
|
26
|
+
ast (~> 2.2)
|
27
|
+
power_assert (1.0.1)
|
28
|
+
powerpack (0.1.1)
|
29
|
+
rainbow (2.2.1)
|
30
|
+
rake (10.5.0)
|
31
|
+
rubocop (0.42.0)
|
32
|
+
parser (>= 2.3.1.1, < 3.0)
|
33
|
+
powerpack (~> 0.1)
|
34
|
+
rainbow (>= 1.99.1, < 3.0)
|
35
|
+
ruby-progressbar (~> 1.7)
|
36
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
37
|
+
ruby-progressbar (1.8.1)
|
38
|
+
sigdump (0.2.4)
|
39
|
+
string-scrub (0.0.5)
|
40
|
+
test-unit (3.2.3)
|
41
|
+
power_assert
|
42
|
+
thread_safe (0.3.6)
|
43
|
+
tzinfo (1.2.2)
|
44
|
+
thread_safe (~> 0.1)
|
45
|
+
tzinfo-data (1.2017.1)
|
46
|
+
tzinfo (>= 1.0.0)
|
47
|
+
unicode-display_width (1.1.3)
|
48
|
+
yajl-ruby (1.3.0)
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
fluent-plugin-detect-exceptions-with-error!
|
55
|
+
rake (~> 10.3)
|
56
|
+
rubocop (= 0.42.0)
|
57
|
+
test-unit (~> 3.0)
|
58
|
+
|
59
|
+
BUNDLED WITH
|
60
|
+
1.14.6
|
data/README.rdoc
CHANGED
@@ -1,110 +1,21 @@
|
|
1
1
|
= Exception detector plugin for {fluentd}[http://github.com/fluent/fluentd]
|
2
2
|
|
3
|
-
fluent-plugin-detect-exceptions is
|
4
|
-
|
5
|
-
|
6
|
-
stack traces: If a consecutive sequence of log messages forms an exception stack
|
7
|
-
trace, the log messages are forwarded as a single, combined log message.
|
8
|
-
Otherwise, the input log data is forwarded as is.
|
3
|
+
fluent-plugin-detect-exceptions-with-error is a fork of {fluent-plugin-detect-exceptions}[https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions] which
|
4
|
+
- includes an ERROR message line preceding the stack trace in the combined exception message
|
5
|
+
- handles additional types of line found in Java stack traces, such as 'common frames omitted'
|
9
6
|
|
10
|
-
Text log messages are assumed to contain single lines and are combined by
|
11
|
-
concatenating them.
|
12
|
-
|
13
|
-
For JSON records, the log message is taken from a configurable message field
|
14
|
-
of the log record. The message field is assumed to contain a single line of
|
15
|
-
text. If the message fields of a consecutive sequence of logs records
|
16
|
-
form an exception stack, they are combined to a single log record by taking
|
17
|
-
the first log record of the sequence and replacing the content of the message
|
18
|
-
field with the concatenated content of all message fields in the sequence.
|
19
|
-
Note that the content of other fields in the records of the sequence are thus
|
20
|
-
not reflected in the combined output. This plugin is intended to be used in
|
21
|
-
cases where the content of log records that belong to a single exception stack
|
22
|
-
are so similar (e.g. because they contain the timestamp of the log entry) that
|
23
|
-
this loss of information is irrelevant.
|
24
|
-
|
25
|
-
This is NOT an official Google product.
|
26
|
-
|
27
|
-
{<img src="https://badge.fury.io/rb/fluent-plugin-detect-exceptions.svg" alt="Gem Version" />}[http://badge.fury.io/rb/fluent-plugin-detect-exceptions]
|
28
|
-
{<img src="https://secure.travis-ci.org/GoogleCloudPlatform/fluent-plugin-detect-exceptions.png" alt="Build Status" />}[https://travis-ci.org/GoogleCloudPlatform/fluent-plugin-detect-exceptions]
|
29
7
|
|
30
8
|
== Installation
|
31
9
|
|
32
10
|
This gem is hosted at
|
33
|
-
{RubyGems.org}[https://rubygems.org/gems/fluent-plugin-detect-exceptions]
|
11
|
+
{RubyGems.org}[https://rubygems.org/gems/fluent-plugin-detect-exceptions-with-error]
|
34
12
|
and can be installed using:
|
35
13
|
|
36
14
|
$ gem install fluent-plugin-detect-exceptions-with-error
|
37
15
|
|
38
|
-
Installing {google-fluentd}[https://cloud.google.com/logging/docs/agent/]
|
39
|
-
will also install and configure the gem.
|
40
|
-
|
41
16
|
== Configuration
|
42
17
|
|
43
|
-
The plugin supports the
|
44
|
-
|
45
|
-
[message] Name of the field in the JSON record that contains the
|
46
|
-
single-line log messages that shall be scanned for exceptions.
|
47
|
-
If this is set to '', the plugin will try 'message' and 'log',
|
48
|
-
in that order.
|
49
|
-
This parameter is only applicable to structured (JSON) log streams.
|
50
|
-
Default: ''.
|
51
|
-
|
52
|
-
[remove_tag_prefix] The prefix to remove from the input tag when outputting
|
53
|
-
a record. A prefix has to be a complete tag part.
|
54
|
-
Example: If remove_tag_prefix is set to 'foo', the input
|
55
|
-
tag foo.bar.baz is transformed to bar.baz and the input tag
|
56
|
-
'foofoo.bar' is not modified. Default: empty string.
|
57
|
-
|
58
|
-
[languages] A list of language for which exception stack traces shall be
|
59
|
-
detected. The values in the list can be separated by commas or
|
60
|
-
written as JSON list.
|
61
|
-
Supported values: java, js, csharp, python, go, ruby, php, all.
|
62
|
-
Default: all.
|
63
|
-
|
64
|
-
[multiline_flush_interval] Interval in seconds after which a (possibly not
|
65
|
-
yet complete) buffered exception stack shall be
|
66
|
-
forwarded. If not set, incomplete exceptions stacks
|
67
|
-
are not flushed.
|
68
|
-
|
69
|
-
[max_lines] Maximum number of lines in a detected exception stack trace.
|
70
|
-
If this maximum number is exceeded, the exception stack trace
|
71
|
-
that has been detected so far will be output as a single
|
72
|
-
log message and the detection will start from scratch.
|
73
|
-
This is intended as a safeguard against buffering very large
|
74
|
-
amounts of data before outputting them to the log stream.
|
75
|
-
Zero means no limit.
|
76
|
-
Default: 1000.
|
77
|
-
|
78
|
-
[max_bytes] Maximum number of bytes in a detected exception stack trace.
|
79
|
-
If this maximum number is exceeded, the exception stack trace
|
80
|
-
that has been detected so far will be output as a single
|
81
|
-
log message and the detection will start from scratch.
|
82
|
-
This is intended as a safeguard against buffering very large
|
83
|
-
amounts of data before outputting them to the log stream.
|
84
|
-
Zero means no limit.
|
85
|
-
Default: 0.
|
86
|
-
|
87
|
-
[stream] Name of the field in the JSON record that contains the name of a
|
88
|
-
logical log stream within the "real" log stream.
|
89
|
-
The exception detection is handled separately for each logical
|
90
|
-
log stream, i.e., exceptions will be detected even if the messages
|
91
|
-
for the logical log streams are interleaved in the "real" log stream.
|
92
|
-
Consequently, only records in the same logical stream will be
|
93
|
-
combined.
|
94
|
-
This parameter is ignored if set to ''.
|
95
|
-
This parameter is only applicable to structured (JSON) log streams.
|
96
|
-
Default: ''.
|
97
|
-
|
98
|
-
Example configuration:
|
18
|
+
The plugin supports the same parameters as {fluent-plugin-detect-exceptions}[https://github.com/GoogleCloudPlatform/fluent-plugin-detect-exceptions]
|
99
19
|
|
100
|
-
<match **>
|
101
|
-
remove_tag_prefix foo
|
102
|
-
message log
|
103
|
-
languages java, python
|
104
|
-
multiline_flush_interval 0.1
|
105
|
-
</match>
|
106
20
|
|
107
|
-
== Copyright
|
108
21
|
|
109
|
-
Copyright:: Copyright 2016 Google Inc. All rights reserved.
|
110
|
-
License:: Apache License, Version 2.0
|
Binary file
|
@@ -6,8 +6,8 @@ eos
|
|
6
6
|
gem.summary = \
|
7
7
|
'fluentd output plugin for combining error messages and stack traces as multi-line JSON logs'
|
8
8
|
gem.license = 'Apache-2.0'
|
9
|
-
gem.version = '0.0.
|
10
|
-
gem.authors = ['
|
9
|
+
gem.version = '0.0.2a'
|
10
|
+
gem.authors = ['Paul Boocock']
|
11
11
|
gem.required_ruby_version = Gem::Requirement.new('>= 2.0')
|
12
12
|
|
13
13
|
gem.files = Dir['**/*'].keep_if { |file| File.file?(file) }
|
@@ -50,12 +50,12 @@ module Fluent
|
|
50
50
|
end
|
51
51
|
|
52
52
|
JAVA_RULES = [
|
53
|
-
rule(:start_state,
|
54
|
-
|
55
|
-
|
53
|
+
rule(:start_state, /(?:Exception|Error|Throwable|V8 errors stack trace)[:\r\n]/, :java),
|
54
|
+
rule(:start_state, /^ERROR /, :java_stack_begin),
|
55
|
+
rule(:java_stack_begin, /(?:Exception|Error|Throwable|V8 errors stack trace)[:\r\n]/, :java),
|
56
56
|
rule(:java, /^[\t ]+(?:eval )?at /, :java),
|
57
57
|
rule(:java, /^[\t ]*(?:Caused by|Suppressed):/, :java),
|
58
|
-
rule(:java, /^[\t ]*... \d+\ more/, :java)
|
58
|
+
rule(:java, /^[\t ]*... \d+\ (more|common frames omitted)/, :java)
|
59
59
|
].freeze
|
60
60
|
|
61
61
|
PYTHON_RULES = [
|
@@ -33,6 +33,22 @@ Exception: foo
|
|
33
33
|
at bar
|
34
34
|
END
|
35
35
|
|
36
|
+
JAVA_EXC_WITH_ERROR = <<END.freeze
|
37
|
+
ERROR Something nasty
|
38
|
+
Exception: foo
|
39
|
+
at bar
|
40
|
+
END
|
41
|
+
|
42
|
+
JAVA_EXC_WITH_ERROR_CAUSE_MORE = <<END.freeze
|
43
|
+
ERROR Something nasty
|
44
|
+
SomeException: foo
|
45
|
+
at bar
|
46
|
+
... 26 common frames omitted
|
47
|
+
Caused by: org.AnotherException
|
48
|
+
at bar2
|
49
|
+
at bar3
|
50
|
+
END
|
51
|
+
|
36
52
|
PYTHON_EXC = <<END.freeze
|
37
53
|
Traceback (most recent call last):
|
38
54
|
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
|
@@ -95,6 +111,26 @@ END
|
|
95
111
|
assert_equal(make_logs(t, *messages), d.events)
|
96
112
|
end
|
97
113
|
|
114
|
+
def test_exception_detection_with_error
|
115
|
+
d = create_driver
|
116
|
+
t = Time.now.to_i
|
117
|
+
messages = [ARBITRARY_TEXT, JAVA_EXC_WITH_ERROR, ARBITRARY_TEXT]
|
118
|
+
d.run do
|
119
|
+
feed_lines(d, t, *messages)
|
120
|
+
end
|
121
|
+
assert_equal(make_logs(t, *messages), d.events)
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_exception_detection_with_error_and_cause
|
125
|
+
d = create_driver
|
126
|
+
t = Time.now.to_i
|
127
|
+
messages = [ARBITRARY_TEXT, JAVA_EXC_WITH_ERROR_CAUSE_MORE, ARBITRARY_TEXT]
|
128
|
+
d.run do
|
129
|
+
feed_lines(d, t, *messages)
|
130
|
+
end
|
131
|
+
assert_equal(make_logs(t, *messages), d.events)
|
132
|
+
end
|
133
|
+
|
98
134
|
def test_single_language_config
|
99
135
|
cfg = 'languages java'
|
100
136
|
d = create_driver(cfg)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-detect-exceptions-with-error
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2a
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Paul Boocock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -74,8 +74,10 @@ extensions: []
|
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
76
|
- CONTRIBUTING
|
77
|
+
- fluent-plugin-detect-exceptions-with-error-0.0.2.gem
|
77
78
|
- fluent-plugin-detect-exceptions-with-error.gemspec
|
78
79
|
- Gemfile
|
80
|
+
- Gemfile.lock
|
79
81
|
- lib/fluent/plugin/exception_detector.rb
|
80
82
|
- lib/fluent/plugin/out_detect_exceptions.rb
|
81
83
|
- LICENSE
|
@@ -100,9 +102,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
102
|
version: '2.0'
|
101
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
104
|
requirements:
|
103
|
-
- - '
|
105
|
+
- - '>'
|
104
106
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
107
|
+
version: 1.3.1
|
106
108
|
requirements: []
|
107
109
|
rubyforge_project:
|
108
110
|
rubygems_version: 2.0.14.1
|