fluent-plugin-remote_syslog 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yaml +26 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +0 -2
- data/README.md +14 -3
- data/VERSION +1 -1
- data/fluent-plugin-remote_syslog.gemspec +4 -3
- data/lib/fluent/plugin/out_remote_syslog.rb +19 -0
- data/test/plugin/out_remote_syslog.rb +79 -23
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 34d4b7218edc54b5340ea9d168603f72d50ed038cc6b262b22a5a2045c00aa50
|
4
|
+
data.tar.gz: 3f2340c1507f45567d45e6b57c2129978ee2e01809567a68dc8438ce6fc1eec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6fca5b050b67064465bdf08bdb53e650d5aa73f53b9d8cfc847717fdda4c2bf18f6ba9ad67a835430b8a1e88eedbcf138f77c85132d11813f109dd7aa5412e0
|
7
|
+
data.tar.gz: fbaf7442c5e3bc25618678250bad84d2099dc7216c21938f5c5d083b4788f9e9446fdaa2a027ddd76376d0d1d93509f4bdd6983b43fe0176122b443c6b91d4d6
|
@@ -0,0 +1,26 @@
|
|
1
|
+
on:
|
2
|
+
- push
|
3
|
+
- pull_request
|
4
|
+
name: Unit test
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ${{ matrix.os }}
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [ '2.7', '3.1' ]
|
12
|
+
os:
|
13
|
+
- windows-latest
|
14
|
+
- ubuntu-latest
|
15
|
+
- macos-latest
|
16
|
+
name: Test on ${{ matrix.os }} with Ruby ${{ matrix.ruby }}
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- name: Install dependencies
|
24
|
+
run: bundle
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake test
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 1.1.0
|
2
|
+
|
3
|
+
* Up rake dependency version for CVE-2020-8130
|
4
|
+
* Support "warning" Severity in addition to "warn" [#51](https://github.com/fluent-plugins-nursery/fluent-plugin-remote_syslog/pull/51)
|
5
|
+
* Make `packet_size` option valid to UDP [#46](https://github.com/fluent-plugins-nursery/fluent-plugin-remote_syslog/pull/46)
|
6
|
+
|
1
7
|
## 1.0.0
|
2
8
|
|
3
9
|
* Support fluentd-0.14 or later features [#24](https://github.com/dlackty/fluent-plugin-remote_syslog/pull/24)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -13,8 +13,16 @@
|
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
16
|
+
* Fluentd
|
17
|
+
|
18
|
+
```bash
|
19
|
+
$ fluent-gem install fluent-plugin-remote_syslog
|
20
|
+
```
|
21
|
+
|
22
|
+
* td-agent
|
23
|
+
|
16
24
|
```bash
|
17
|
-
|
25
|
+
$ td-agent-gem install fluent-plugin-remote_syslog
|
18
26
|
```
|
19
27
|
|
20
28
|
## Usage
|
@@ -33,7 +41,7 @@
|
|
33
41
|
|
34
42
|
<format>
|
35
43
|
@type single_value
|
36
|
-
message_key
|
44
|
+
message_key message
|
37
45
|
</format>
|
38
46
|
</match>
|
39
47
|
```
|
@@ -80,4 +88,7 @@
|
|
80
88
|
|
81
89
|
## License
|
82
90
|
|
83
|
-
Copyright (c) 2014-2017 Richard Lee.
|
91
|
+
Copyright (c) 2014-2017 Richard Lee.
|
92
|
+
Copyright (c) 2022 Daijiro Fukuda.
|
93
|
+
|
94
|
+
See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
@@ -5,8 +5,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "fluent-plugin-remote_syslog"
|
7
7
|
spec.version = File.read("VERSION").strip
|
8
|
-
spec.authors = ["Richard Lee"]
|
9
|
-
spec.email = ["dlackty@gmail.com"]
|
8
|
+
spec.authors = ["Richard Lee", "Daijiro Fukuda"]
|
9
|
+
spec.email = ["dlackty@gmail.com", "fukuda@clear-code.com"]
|
10
10
|
spec.summary = %q{Fluentd output plugin for remote syslog}
|
11
11
|
spec.description = spec.description
|
12
12
|
spec.homepage = "https://github.com/dlackty/fluent-plugin-remote_syslog"
|
@@ -16,7 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_development_dependency "
|
19
|
+
spec.add_development_dependency "bundler", '~> 2.0'
|
20
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
20
21
|
spec.add_development_dependency "test-unit"
|
21
22
|
spec.add_development_dependency "test-unit-rr"
|
22
23
|
|
@@ -96,6 +96,8 @@ module Fluent
|
|
96
96
|
program = extract_placeholders(@program, chunk.metadata)
|
97
97
|
hostname = extract_placeholders(@hostname, chunk.metadata)
|
98
98
|
|
99
|
+
severity = SeverityMapper.map(severity)
|
100
|
+
|
99
101
|
packet_options = {facility: facility, severity: severity, program: program}
|
100
102
|
packet_options[:hostname] = hostname unless hostname.empty?
|
101
103
|
|
@@ -144,11 +146,28 @@ module Fluent
|
|
144
146
|
port,
|
145
147
|
whinyerrors: true,
|
146
148
|
program: @program,
|
149
|
+
packet_size: @packet_size,
|
147
150
|
)
|
148
151
|
end
|
149
152
|
@senders << sender
|
150
153
|
sender
|
151
154
|
end
|
155
|
+
|
156
|
+
# Convert some Severity values that is not supported in `syslog_protocol` library:
|
157
|
+
# https://github.com/eric/syslog_protocol
|
158
|
+
# We want to fix `syslog_protocol` itself, but it seems to be not maintained for a while.
|
159
|
+
# If the following PR is merged, we can remove this implementaion.
|
160
|
+
# https://github.com/eric/syslog_protocol/pull/9
|
161
|
+
module SeverityMapper
|
162
|
+
DICT = {
|
163
|
+
# "warning" is not supported, but we should use it since "warn" is deprecated.
|
164
|
+
"warning" => "warn",
|
165
|
+
}
|
166
|
+
|
167
|
+
def self.map(severity)
|
168
|
+
DICT[severity] || severity
|
169
|
+
end
|
170
|
+
end
|
152
171
|
end
|
153
172
|
end
|
154
173
|
end
|
@@ -1,17 +1,23 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
require "fluent/plugin/out_remote_syslog"
|
3
|
+
require "fluent/plugin/in_syslog"
|
4
|
+
require 'fluent/test/driver/input'
|
3
5
|
|
4
6
|
class RemoteSyslogOutputTest < Test::Unit::TestCase
|
5
7
|
def setup
|
6
8
|
Fluent::Test.setup
|
7
9
|
end
|
8
10
|
|
9
|
-
def
|
11
|
+
def create_driver_out_syslog(conf)
|
10
12
|
Fluent::Test::Driver::Output.new(Fluent::Plugin::RemoteSyslogOutput).configure(conf)
|
11
13
|
end
|
12
14
|
|
15
|
+
def create_driver_in_syslog(conf)
|
16
|
+
Fluent::Test::Driver::Input.new(Fluent::Plugin::SyslogInput).configure(conf)
|
17
|
+
end
|
18
|
+
|
13
19
|
def test_configure
|
14
|
-
d =
|
20
|
+
d = create_driver_out_syslog %[
|
15
21
|
@type remote_syslog
|
16
22
|
hostname foo.com
|
17
23
|
host example.com
|
@@ -28,13 +34,16 @@ class RemoteSyslogOutputTest < Test::Unit::TestCase
|
|
28
34
|
assert_equal "debug", d.instance.instance_variable_get(:@severity)
|
29
35
|
end
|
30
36
|
|
31
|
-
|
32
|
-
|
37
|
+
data("debug", {severity: "debug"})
|
38
|
+
data("warn", {severity: "warn"})
|
39
|
+
data("warning", {severity: "warning", expected_severity: "warn"})
|
40
|
+
def test_write_udp(data)
|
41
|
+
out_driver = create_driver_out_syslog %[
|
33
42
|
@type remote_syslog
|
34
43
|
hostname foo.com
|
35
|
-
host
|
44
|
+
host localhost
|
36
45
|
port 5566
|
37
|
-
severity
|
46
|
+
severity #{data[:severity]}
|
38
47
|
program minitest
|
39
48
|
|
40
49
|
<format>
|
@@ -43,22 +52,41 @@ class RemoteSyslogOutputTest < Test::Unit::TestCase
|
|
43
52
|
</format>
|
44
53
|
]
|
45
54
|
|
46
|
-
|
47
|
-
|
48
|
-
|
55
|
+
in_driver = create_driver_in_syslog %[
|
56
|
+
@type syslog
|
57
|
+
tag tag
|
58
|
+
port 5566
|
59
|
+
bind 127.0.0.1
|
60
|
+
]
|
49
61
|
|
50
|
-
|
51
|
-
|
62
|
+
in_driver.run(expect_records: 1, timeout: 5) do
|
63
|
+
out_driver.run do
|
64
|
+
out_driver.feed("tag", Fluent::EventTime.now, {"message" => "This is a test message."})
|
65
|
+
end
|
52
66
|
end
|
67
|
+
|
68
|
+
assert_equal 1, in_driver.events.length
|
69
|
+
|
70
|
+
tag, _, msg = in_driver.events[0]
|
71
|
+
|
72
|
+
expected_facility = "user"
|
73
|
+
expected_severity = data[:expected_severity] || data[:severity]
|
74
|
+
assert_equal("tag.#{expected_facility}.#{expected_severity}", tag)
|
75
|
+
assert_equal("foo.com", msg["host"])
|
76
|
+
assert_equal("minitest", msg["ident"])
|
77
|
+
assert_equal("This is a test message.", msg["message"])
|
53
78
|
end
|
54
79
|
|
55
|
-
|
56
|
-
|
80
|
+
data("debug", {severity: "debug"})
|
81
|
+
data("warn", {severity: "warn"})
|
82
|
+
data("warning", {severity: "warning", expected_severity: "warn"})
|
83
|
+
def test_write_tcp(data)
|
84
|
+
out_driver = create_driver_out_syslog %[
|
57
85
|
@type remote_syslog
|
58
86
|
hostname foo.com
|
59
|
-
host
|
87
|
+
host localhost
|
60
88
|
port 5566
|
61
|
-
severity
|
89
|
+
severity #{data[:severity]}
|
62
90
|
program minitest
|
63
91
|
|
64
92
|
protocol tcp
|
@@ -69,16 +97,44 @@ class RemoteSyslogOutputTest < Test::Unit::TestCase
|
|
69
97
|
</format>
|
70
98
|
]
|
71
99
|
|
72
|
-
|
73
|
-
|
74
|
-
|
100
|
+
in_driver = create_driver_in_syslog %[
|
101
|
+
@type syslog
|
102
|
+
tag tag
|
103
|
+
port 5566
|
104
|
+
bind 127.0.0.1
|
105
|
+
protocol_type tcp
|
106
|
+
]
|
75
107
|
|
76
|
-
|
77
|
-
|
108
|
+
in_driver.run(expect_records: 1, timeout: 5) do
|
109
|
+
out_driver.run do
|
110
|
+
out_driver.feed("tag", Fluent::EventTime.now, {"message" => "This is a test message."})
|
111
|
+
end
|
78
112
|
end
|
79
113
|
|
80
|
-
|
81
|
-
|
82
|
-
|
114
|
+
assert_equal 1, in_driver.events.length
|
115
|
+
|
116
|
+
tag, _, msg = in_driver.events[0]
|
117
|
+
|
118
|
+
expected_facility = "user"
|
119
|
+
expected_severity = data[:expected_severity] || data[:severity]
|
120
|
+
assert_equal("tag.#{expected_facility}.#{expected_severity}", tag)
|
121
|
+
assert_equal("foo.com", msg["host"])
|
122
|
+
assert_equal("minitest", msg["ident"])
|
123
|
+
assert_equal("This is a test message.", msg["message"])
|
124
|
+
end
|
125
|
+
|
126
|
+
data("emerg", {in: "emerg", out: "emerg"})
|
127
|
+
data("alert", {in: "alert", out: "alert"})
|
128
|
+
data("crit", {in: "crit", out: "crit"})
|
129
|
+
data("err", {in: "err", out: "err"})
|
130
|
+
data("warn", {in: "warn", out: "warn"})
|
131
|
+
data("warning", {in: "warning", out: "warn"})
|
132
|
+
data("notice", {in: "notice", out: "notice"})
|
133
|
+
data("info", {in: "info", out: "info"})
|
134
|
+
data("debug", {in: "debug", out: "debug"})
|
135
|
+
data("wrong", {in: "wrong", out: "wrong"})
|
136
|
+
def test_severity_mapper(data)
|
137
|
+
out = Fluent::Plugin::RemoteSyslogOutput::SeverityMapper.map(data[:in])
|
138
|
+
assert_equal(data[:out], out)
|
83
139
|
end
|
84
140
|
end
|
metadata
CHANGED
@@ -1,29 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-remote_syslog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Lee
|
8
|
+
- Daijiro Fukuda
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2022-09-29 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '2.0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '2.0'
|
13
28
|
- !ruby/object:Gem::Dependency
|
14
29
|
name: rake
|
15
30
|
requirement: !ruby/object:Gem::Requirement
|
16
31
|
requirements:
|
17
32
|
- - "~>"
|
18
33
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
34
|
+
version: '13.0'
|
20
35
|
type: :development
|
21
36
|
prerelease: false
|
22
37
|
version_requirements: !ruby/object:Gem::Requirement
|
23
38
|
requirements:
|
24
39
|
- - "~>"
|
25
40
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
41
|
+
version: '13.0'
|
27
42
|
- !ruby/object:Gem::Dependency
|
28
43
|
name: test-unit
|
29
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,10 +98,12 @@ dependencies:
|
|
83
98
|
description: ''
|
84
99
|
email:
|
85
100
|
- dlackty@gmail.com
|
101
|
+
- fukuda@clear-code.com
|
86
102
|
executables: []
|
87
103
|
extensions: []
|
88
104
|
extra_rdoc_files: []
|
89
105
|
files:
|
106
|
+
- ".github/workflows/test.yaml"
|
90
107
|
- ".gitignore"
|
91
108
|
- ".travis.yml"
|
92
109
|
- CHANGELOG.md
|
@@ -118,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
135
|
- !ruby/object:Gem::Version
|
119
136
|
version: '0'
|
120
137
|
requirements: []
|
121
|
-
|
122
|
-
rubygems_version: 2.6.13
|
138
|
+
rubygems_version: 3.1.6
|
123
139
|
signing_key:
|
124
140
|
specification_version: 4
|
125
141
|
summary: Fluentd output plugin for remote syslog
|