logstash-output-syslog 2.1.4 → 3.0.1
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 +16 -3
- data/LICENSE +1 -1
- data/README.md +12 -3
- data/lib/logstash/outputs/syslog.rb +0 -3
- data/logstash-output-syslog.gemspec +3 -3
- data/spec/outputs/syslog_spec.rb +29 -14
- metadata +22 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dc9077162c64d40cf296402a0bb0e936f9de3d2
|
4
|
+
data.tar.gz: 790819973615929988a5c0f5ac622f6d3e3e62ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb8e7e2079dc6f8755be685ff626a44aeb9d0b5c72f7e91918c76e3fcc58e1fa6a0932e89107f55bb05d5dba76765503af407bd9b07f108c2ad2cc9ba6e1765
|
7
|
+
data.tar.gz: 9ce3ba29d2a1b4bfbcf222e31ea5e2e944a96d088066a28b6c8caa63218c9cea6c969fe288b52fed22f396bad7cf3bfd330889e45e5486f646788106ae7ef8a2
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,22 @@
|
|
1
|
-
|
1
|
+
## 3.0.1
|
2
|
+
- Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
|
3
|
+
|
4
|
+
## 3.0.0
|
5
|
+
- breaking,config: Remove deprecated `timestamp` config.
|
6
|
+
- internal: migrate to Logstash Event API 2.0
|
7
|
+
|
8
|
+
## 2.1.5
|
9
|
+
- [Internal] test fix to not depend on json order
|
10
|
+
|
11
|
+
## 2.1.4
|
2
12
|
- [Internal] fix tests
|
3
|
-
|
13
|
+
|
14
|
+
## 2.1.3
|
4
15
|
- Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
|
5
|
-
|
16
|
+
|
17
|
+
## 2.1.2
|
6
18
|
- New dependency requirements for logstash-core for the 5.0 release
|
19
|
+
|
7
20
|
## 2.1.1
|
8
21
|
- Add SSL/TLS support to syslog output plugin (thanks @breml)
|
9
22
|
- Added ability to use codecs for this output (thanks @breml)
|
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%20Outputs/job/logstash-plugin-output-syslog-unit/)
|
3
|
+
[](https://travis-ci.org/logstash-plugins/logstash-output-syslog)
|
5
4
|
|
6
5
|
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
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
|
|
@@ -106,9 +106,6 @@ class LogStash::Outputs::Syslog < LogStash::Outputs::Base
|
|
106
106
|
# to help you build a new value from other parts of the event.
|
107
107
|
config :sourcehost, :validate => :string, :default => "%{host}"
|
108
108
|
|
109
|
-
# timestamp for syslog message
|
110
|
-
config :timestamp, :validate => :string, :default => "%{@timestamp}", :deprecated => "This setting is no longer necessary. The RFC setting will determine what time format is used."
|
111
|
-
|
112
109
|
# application name for syslog message. The new value can include `%{foo}` strings
|
113
110
|
# to help you build a new value from other parts of the event.
|
114
111
|
config :appname, :validate => :string, :default => "LOGSTASH"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-output-syslog'
|
4
|
-
s.version = '
|
4
|
+
s.version = '3.0.1'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Send events to a syslog server."
|
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"
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
|
21
21
|
|
22
22
|
# Gem dependencies
|
23
|
-
s.add_runtime_dependency "logstash-core-plugin-api", "
|
23
|
+
s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
|
24
24
|
s.add_runtime_dependency 'logstash-codec-plain'
|
25
25
|
|
26
26
|
s.add_development_dependency 'logstash-devutils'
|
data/spec/outputs/syslog_spec.rb
CHANGED
@@ -3,9 +3,13 @@
|
|
3
3
|
require "logstash/devutils/rspec/spec_helper"
|
4
4
|
require "logstash/outputs/syslog"
|
5
5
|
require "logstash/codecs/plain"
|
6
|
+
require "json"
|
6
7
|
|
7
8
|
describe LogStash::Outputs::Syslog do
|
8
9
|
|
10
|
+
RFC3164_DATE_TIME_REGEX = "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) ([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)"
|
11
|
+
RFC3339_DATE_TIME_REGEX = "([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]{3})?([Zz]|([+-]([01][0-9]|2[0-3]):[0-5][0-9]))"
|
12
|
+
|
9
13
|
it "should register without errors" do
|
10
14
|
plugin = LogStash::Plugin.lookup("output", "syslog").new({"host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency"})
|
11
15
|
expect { plugin.register }.to_not raise_error
|
@@ -30,21 +34,21 @@ describe LogStash::Outputs::Syslog do
|
|
30
34
|
|
31
35
|
context "rfc 3164 and udp by default" do
|
32
36
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency"} }
|
33
|
-
let(:output) { /^<0
|
37
|
+
let(:output) { /^<0>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: bar\n/m }
|
34
38
|
|
35
39
|
it_behaves_like "syslog output"
|
36
40
|
end
|
37
41
|
|
38
42
|
context "rfc 5424 and tcp" do
|
39
43
|
let(:options) { {"rfc" => "rfc5424", "protocol" => "tcp", "host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency"} }
|
40
|
-
let(:output) { /^<0>1
|
44
|
+
let(:output) { /^<0>1 #{RFC3339_DATE_TIME_REGEX} baz LOGSTASH - - - bar\n/m }
|
41
45
|
|
42
46
|
it_behaves_like "syslog output"
|
43
47
|
end
|
44
48
|
|
45
49
|
context "calculate priority" do
|
46
50
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "mail", "severity" => "critical"} }
|
47
|
-
let(:output) { /^<18
|
51
|
+
let(:output) { /^<18>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: bar\n/m }
|
48
52
|
|
49
53
|
it_behaves_like "syslog output"
|
50
54
|
end
|
@@ -52,7 +56,7 @@ describe LogStash::Outputs::Syslog do
|
|
52
56
|
context "sprintf rfc 3164" do
|
53
57
|
let(:event) { LogStash::Event.new({"message" => "bar", "host" => "baz", "facility" => "mail", "severity" => "critical", "appname" => "appname", "procid" => "1000" }) }
|
54
58
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "%{facility}", "severity" => "%{severity}", "appname" => "%{appname}", "procid" => "%{procid}"} }
|
55
|
-
let(:output) { /^<18
|
59
|
+
let(:output) { /^<18>#{RFC3164_DATE_TIME_REGEX} baz appname\[1000\]: bar\n/m }
|
56
60
|
|
57
61
|
it_behaves_like "syslog output"
|
58
62
|
end
|
@@ -60,7 +64,7 @@ describe LogStash::Outputs::Syslog do
|
|
60
64
|
context "sprintf rfc 5424" do
|
61
65
|
let(:event) { LogStash::Event.new({"message" => "bar", "host" => "baz", "facility" => "mail", "severity" => "critical", "appname" => "appname", "procid" => "1000", "msgid" => "2000" }) }
|
62
66
|
let(:options) { {"rfc" => "rfc5424", "host" => "foo", "port" => "123", "facility" => "%{facility}", "severity" => "%{severity}", "appname" => "%{appname}", "procid" => "%{procid}", "msgid" => "%{msgid}"} }
|
63
|
-
let(:output) { /^<18>1
|
67
|
+
let(:output) { /^<18>1 #{RFC3339_DATE_TIME_REGEX} baz appname 1000 2000 - bar\n/m }
|
64
68
|
|
65
69
|
it_behaves_like "syslog output"
|
66
70
|
end
|
@@ -68,7 +72,7 @@ describe LogStash::Outputs::Syslog do
|
|
68
72
|
context "use_labels == false, default" do
|
69
73
|
let(:event) { LogStash::Event.new({"message" => "bar", "host" => "baz" }) }
|
70
74
|
let(:options) { {"use_labels" => false, "host" => "foo", "port" => "123" } }
|
71
|
-
let(:output) { /^<13
|
75
|
+
let(:output) { /^<13>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: bar\n/m }
|
72
76
|
|
73
77
|
it_behaves_like "syslog output"
|
74
78
|
end
|
@@ -76,7 +80,7 @@ describe LogStash::Outputs::Syslog do
|
|
76
80
|
context "use_labels == false, syslog_pri" do
|
77
81
|
let(:event) { LogStash::Event.new({"message" => "bar", "host" => "baz", "syslog_pri" => "18" }) }
|
78
82
|
let(:options) { {"use_labels" => false, "host" => "foo", "port" => "123" } }
|
79
|
-
let(:output) { /^<18
|
83
|
+
let(:output) { /^<18>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: bar\n/m }
|
80
84
|
|
81
85
|
it_behaves_like "syslog output"
|
82
86
|
end
|
@@ -84,7 +88,7 @@ describe LogStash::Outputs::Syslog do
|
|
84
88
|
context "use_labels == false, sprintf" do
|
85
89
|
let(:event) { LogStash::Event.new({"message" => "bar", "host" => "baz", "priority" => "18" }) }
|
86
90
|
let(:options) { {"use_labels" => false, "host" => "foo", "port" => "123", "priority" => "%{priority}" } }
|
87
|
-
let(:output) { /^<18
|
91
|
+
let(:output) { /^<18>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: bar\n/m }
|
88
92
|
|
89
93
|
it_behaves_like "syslog output"
|
90
94
|
end
|
@@ -92,35 +96,46 @@ describe LogStash::Outputs::Syslog do
|
|
92
96
|
context "use plain codec with format set" do
|
93
97
|
let(:plain) { LogStash::Codecs::Plain.new({"format" => "%{host} %{message}"}) }
|
94
98
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency", "codec" => plain} }
|
95
|
-
let(:output) { /^<0
|
99
|
+
let(:output) { /^<0>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: baz bar\n/m }
|
96
100
|
|
97
101
|
it_behaves_like "syslog output"
|
98
102
|
end
|
99
103
|
|
100
104
|
context "use codec json" do
|
101
105
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency", "codec" => "json" } }
|
102
|
-
let(:output) { /^<0>.+baz LOGSTASH\[-\]: {\"@timestamp\":\"[0-9TZ:.+-]+\",\"host\":\"baz\",\"@version\":\"1\",\"message\":\"bar\"}\n/m }
|
103
106
|
|
104
|
-
|
107
|
+
it "should write event encoded with json codec" do
|
108
|
+
expect(subject).to receive(:connect).and_return(socket)
|
109
|
+
expect(socket).to receive(:write) do |arg|
|
110
|
+
message = arg[/^<0>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: (.*)/, 1]
|
111
|
+
expect(message).not_to be_nil
|
112
|
+
message_json = JSON.parse(message)
|
113
|
+
expect(message_json).to include("@timestamp")
|
114
|
+
expect(message_json).to include("host" => "baz")
|
115
|
+
expect(message_json).to include("@version" => "1")
|
116
|
+
expect(message_json).to include("message" => "bar")
|
117
|
+
end
|
118
|
+
subject.receive(event)
|
119
|
+
end
|
105
120
|
end
|
106
121
|
|
107
122
|
context "escape carriage return, newline and newline to \\n" do
|
108
123
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency", "message" => "foo\r\nbar\nbaz" } }
|
109
|
-
let(:output) { /^<0
|
124
|
+
let(:output) { /^<0>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: foo\\nbar\\nbaz\n/m }
|
110
125
|
|
111
126
|
it_behaves_like "syslog output"
|
112
127
|
end
|
113
128
|
|
114
129
|
context "tailing newline" do
|
115
130
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency", "message" => "%{message}\n" } }
|
116
|
-
let(:output) { /^<0
|
131
|
+
let(:output) { /^<0>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: bar\n/m }
|
117
132
|
|
118
133
|
it_behaves_like "syslog output"
|
119
134
|
end
|
120
135
|
|
121
136
|
context "tailing carriage return and newline (windows)" do
|
122
137
|
let(:options) { {"host" => "foo", "port" => "123", "facility" => "kernel", "severity" => "emergency", "message" => "%{message}\n" } }
|
123
|
-
let(:output) { /^<0
|
138
|
+
let(:output) { /^<0>#{RFC3164_DATE_TIME_REGEX} baz LOGSTASH\[-\]: bar\n/m }
|
124
139
|
|
125
140
|
it_behaves_like "syslog output"
|
126
141
|
end
|
metadata
CHANGED
@@ -1,33 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-syslog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- -
|
16
|
+
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '1.
|
18
|
+
version: '1.60'
|
19
|
+
- - "<="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.99'
|
19
22
|
name: logstash-core-plugin-api
|
20
23
|
prerelease: false
|
21
24
|
type: :runtime
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.60'
|
30
|
+
- - "<="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '2.99'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
requirement: !ruby/object:Gem::Requirement
|
29
35
|
requirements:
|
30
|
-
- -
|
36
|
+
- - ">="
|
31
37
|
- !ruby/object:Gem::Version
|
32
38
|
version: '0'
|
33
39
|
name: logstash-codec-plain
|
@@ -35,13 +41,13 @@ dependencies:
|
|
35
41
|
type: :runtime
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- -
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
requirement: !ruby/object:Gem::Requirement
|
43
49
|
requirements:
|
44
|
-
- -
|
50
|
+
- - ">="
|
45
51
|
- !ruby/object:Gem::Version
|
46
52
|
version: '0'
|
47
53
|
name: logstash-devutils
|
@@ -49,13 +55,13 @@ dependencies:
|
|
49
55
|
type: :development
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- -
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
requirement: !ruby/object:Gem::Requirement
|
57
63
|
requirements:
|
58
|
-
- -
|
64
|
+
- - ">="
|
59
65
|
- !ruby/object:Gem::Version
|
60
66
|
version: '0'
|
61
67
|
name: logstash-codec-json
|
@@ -63,10 +69,10 @@ dependencies:
|
|
63
69
|
type: :development
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- -
|
72
|
+
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
69
|
-
description: This gem is a
|
75
|
+
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
|
70
76
|
email: info@elastic.co
|
71
77
|
executables: []
|
72
78
|
extensions: []
|
@@ -93,17 +99,17 @@ require_paths:
|
|
93
99
|
- lib
|
94
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
101
|
requirements:
|
96
|
-
- -
|
102
|
+
- - ">="
|
97
103
|
- !ruby/object:Gem::Version
|
98
104
|
version: '0'
|
99
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
|
-
- -
|
107
|
+
- - ">="
|
102
108
|
- !ruby/object:Gem::Version
|
103
109
|
version: '0'
|
104
110
|
requirements: []
|
105
111
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.6.3
|
107
113
|
signing_key:
|
108
114
|
specification_version: 4
|
109
115
|
summary: Send events to a syslog server.
|