logstash-input-log4j 2.0.7-java → 3.0.0-java
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/CHANGELOG.md +2 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.md +12 -3
- data/lib/logstash/inputs/log4j.rb +12 -12
- data/logstash-input-log4j.gemspec +3 -3
- data/spec/inputs/log4j_spec.rb +12 -12
- metadata +18 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82c2333c75035c45d32df73b37a1837a39916010
|
|
4
|
+
data.tar.gz: 793e367219c37a32b5bd821c13eda75e48ccc237
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7c656d8f4d2dcd69f527c340a3311893a725cae983de730031e32306527d7380089b901ea75a788ac82c8d25a00d952b46fc924e0feba8e6c688641c73785d1
|
|
7
|
+
data.tar.gz: 7cbf5ed6c81e483405d8ff8c9b004f9c4b81cf839fd1ffb08006ab3787758520dad3b8420998170629084a924dbd962cd0041c13bc1318b4cf8a66c14c5f6d26
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
## 3.0.0
|
|
2
|
+
- Update the plugin to the version 2.0 of the plugin api, this change is required for Logstash 5.0 compatibility. See https://github.com/elastic/logstash/issues/5141
|
|
1
3
|
# 2.0.7
|
|
2
4
|
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
|
|
3
5
|
# 2.0.6
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Logstash Plugin
|
|
2
2
|
|
|
3
|
-
[](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Inputs/job/logstash-plugin-input-log4j-unit/)
|
|
3
|
+
[](https://travis-ci.org/logstash-plugins/logstash-input-log4j)
|
|
5
4
|
|
|
6
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash) to allow it to receive events from the log4j Socket Appender. Note that it only works with log4j 1.x and not with version 2.
|
|
7
6
|
|
|
@@ -56,7 +55,12 @@ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
|
|
56
55
|
```
|
|
57
56
|
- Install plugin
|
|
58
57
|
```sh
|
|
58
|
+
# Logstash 2.3 and higher
|
|
59
|
+
bin/logstash-plugin install --no-verify
|
|
60
|
+
|
|
61
|
+
# Prior to Logstash 2.3
|
|
59
62
|
bin/plugin install --no-verify
|
|
63
|
+
|
|
60
64
|
```
|
|
61
65
|
- Run Logstash with your plugin
|
|
62
66
|
```sh
|
|
@@ -74,7 +78,12 @@ gem build logstash-filter-awesome.gemspec
|
|
|
74
78
|
```
|
|
75
79
|
- Install the plugin from the Logstash home
|
|
76
80
|
```sh
|
|
77
|
-
|
|
81
|
+
# Logstash 2.3 and higher
|
|
82
|
+
bin/logstash-plugin install --no-verify
|
|
83
|
+
|
|
84
|
+
# Prior to Logstash 2.3
|
|
85
|
+
bin/plugin install --no-verify
|
|
86
|
+
|
|
78
87
|
```
|
|
79
88
|
- Start Logstash and proceed to test the plugin
|
|
80
89
|
|
|
@@ -77,21 +77,21 @@ class LogStash::Inputs::Log4j < LogStash::Inputs::Base
|
|
|
77
77
|
def create_event(log4j_obj)
|
|
78
78
|
# NOTE: log4j_obj is org.apache.log4j.spi.LoggingEvent
|
|
79
79
|
event = LogStash::Event.new("message" => log4j_obj.getRenderedMessage)
|
|
80
|
-
event
|
|
81
|
-
event
|
|
82
|
-
event
|
|
83
|
-
event
|
|
84
|
-
event
|
|
85
|
-
event
|
|
86
|
-
event
|
|
87
|
-
event
|
|
88
|
-
event
|
|
89
|
-
event
|
|
80
|
+
event.set("timestamp", log4j_obj.getTimeStamp)
|
|
81
|
+
event.set("path", log4j_obj.getLoggerName)
|
|
82
|
+
event.set("priority", log4j_obj.getLevel.toString)
|
|
83
|
+
event.set("logger_name", log4j_obj.getLoggerName)
|
|
84
|
+
event.set("thread", log4j_obj.getThreadName)
|
|
85
|
+
event.set("class", log4j_obj.getLocationInformation.getClassName)
|
|
86
|
+
event.set("file", log4j_obj.getLocationInformation.getFileName + ":" + log4j_obj.getLocationInformation.getLineNumber)
|
|
87
|
+
event.set("method", log4j_obj.getLocationInformation.getMethodName)
|
|
88
|
+
event.set("NDC", log4j_obj.getNDC) if log4j_obj.getNDC
|
|
89
|
+
event.set("stack_trace", log4j_obj.getThrowableStrRep.to_a.join("\n")) if log4j_obj.getThrowableInformation
|
|
90
90
|
|
|
91
91
|
# Add the MDC context properties to event
|
|
92
92
|
if log4j_obj.getProperties
|
|
93
93
|
log4j_obj.getPropertyKeySet.each do |key|
|
|
94
|
-
event
|
|
94
|
+
event.set(key, log4j_obj.getProperty(key))
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
return event
|
|
@@ -103,7 +103,7 @@ class LogStash::Inputs::Log4j < LogStash::Inputs::Base
|
|
|
103
103
|
ois = socket_to_inputstream(socket)
|
|
104
104
|
while !stop?
|
|
105
105
|
event = create_event(ois.readObject)
|
|
106
|
-
event
|
|
106
|
+
event.set("host", socket.peer)
|
|
107
107
|
decorate(event)
|
|
108
108
|
output_queue << event
|
|
109
109
|
end # loop do
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
|
|
3
3
|
s.name = 'logstash-input-log4j'
|
|
4
|
-
s.version = '
|
|
4
|
+
s.version = '3.0.0'
|
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
|
6
6
|
s.summary = "Read events over a TCP socket from a Log4j SocketAppender"
|
|
7
|
-
s.description = "This gem is a
|
|
7
|
+
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
|
8
8
|
s.authors = ["Elastic"]
|
|
9
9
|
s.email = 'info@elastic.co'
|
|
10
10
|
s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
|
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
|
|
24
24
|
s.add_runtime_dependency 'logstash-codec-plain'
|
|
25
25
|
|
|
26
|
-
s.add_runtime_dependency "logstash-core-plugin-api", "~>
|
|
26
|
+
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
|
|
27
27
|
|
|
28
28
|
s.add_development_dependency 'logstash-devutils'
|
|
29
29
|
end
|
data/spec/inputs/log4j_spec.rb
CHANGED
|
@@ -60,28 +60,28 @@ describe LogStash::Inputs::Log4j do
|
|
|
60
60
|
|
|
61
61
|
it "creates event with general information" do
|
|
62
62
|
subject = input.create_event(log_obj)
|
|
63
|
-
expect(subject
|
|
64
|
-
expect(subject
|
|
65
|
-
expect(subject
|
|
66
|
-
expect(subject
|
|
67
|
-
expect(subject
|
|
68
|
-
expect(subject
|
|
69
|
-
expect(subject
|
|
63
|
+
expect(subject.get("timestamp")).to eq(1426366971)
|
|
64
|
+
expect(subject.get("path")).to eq("org.apache.log4j.LayoutTest")
|
|
65
|
+
expect(subject.get("priority")).to eq("INFO")
|
|
66
|
+
expect(subject.get("logger_name")).to eq("org.apache.log4j.LayoutTest")
|
|
67
|
+
expect(subject.get("thread")).to be_a(String)
|
|
68
|
+
expect(subject.get("thread")).not_to be_empty
|
|
69
|
+
expect(subject.get("message")).to eq("Hello, World")
|
|
70
70
|
# checks locationInformation is collected, but testing exact values is not meaningful in jruby
|
|
71
|
-
expect(subject
|
|
72
|
-
expect(subject
|
|
73
|
-
expect(subject
|
|
71
|
+
expect(subject.get("class")).not_to be_empty
|
|
72
|
+
expect(subject.get("file")).not_to be_empty
|
|
73
|
+
expect(subject.get("method")).not_to be_empty
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it "creates event without stacktrace" do
|
|
77
77
|
subject = input.create_event(log_obj)
|
|
78
|
-
expect(subject
|
|
78
|
+
expect(subject.get("stack_trace")).to be_nil
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
it "creates event with stacktrace" do
|
|
82
82
|
subject = input.create_event(log_obj_with_stacktrace)
|
|
83
83
|
#checks stack_trace is collected, exact value is too monstruous
|
|
84
|
-
expect(subject
|
|
84
|
+
expect(subject.get("stack_trace")).not_to be_empty
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
end
|
metadata
CHANGED
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: logstash-input-log4j
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Elastic
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: logstash-codec-plain
|
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
|
15
16
|
requirements:
|
|
16
17
|
- - ">="
|
|
17
18
|
- !ruby/object:Gem::Version
|
|
18
19
|
version: '0'
|
|
19
|
-
name: logstash-codec-plain
|
|
20
|
-
prerelease: false
|
|
21
20
|
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: logstash-core-plugin-api
|
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
|
29
30
|
requirements:
|
|
30
31
|
- - "~>"
|
|
31
32
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
33
|
-
name: logstash-core-plugin-api
|
|
34
|
-
prerelease: false
|
|
33
|
+
version: '2.0'
|
|
35
34
|
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '2.0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: logstash-devutils
|
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
|
43
44
|
requirements:
|
|
44
45
|
- - ">="
|
|
45
46
|
- !ruby/object:Gem::Version
|
|
46
47
|
version: '0'
|
|
47
|
-
name: logstash-devutils
|
|
48
|
-
prerelease: false
|
|
49
48
|
type: :development
|
|
49
|
+
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
-
description: This gem is a
|
|
55
|
+
description: This gem is a Logstash plugin required to be installed on top of the
|
|
56
|
+
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
|
57
|
+
gem is not a stand-alone program
|
|
56
58
|
email: info@elastic.co
|
|
57
59
|
executables: []
|
|
58
60
|
extensions: []
|
|
@@ -75,7 +77,7 @@ licenses:
|
|
|
75
77
|
metadata:
|
|
76
78
|
logstash_plugin: 'true'
|
|
77
79
|
logstash_group: input
|
|
78
|
-
post_install_message:
|
|
80
|
+
post_install_message:
|
|
79
81
|
rdoc_options: []
|
|
80
82
|
require_paths:
|
|
81
83
|
- lib
|
|
@@ -90,9 +92,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
90
92
|
- !ruby/object:Gem::Version
|
|
91
93
|
version: '0'
|
|
92
94
|
requirements: []
|
|
93
|
-
rubyforge_project:
|
|
94
|
-
rubygems_version: 2.
|
|
95
|
-
signing_key:
|
|
95
|
+
rubyforge_project:
|
|
96
|
+
rubygems_version: 2.5.1
|
|
97
|
+
signing_key:
|
|
96
98
|
specification_version: 4
|
|
97
99
|
summary: Read events over a TCP socket from a Log4j SocketAppender
|
|
98
100
|
test_files:
|