fluent-plugin-gelf-best 1.3.3 → 1.4.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/README.md +2 -0
- data/lib/fluent/plugin/formatter_gelf.rb +5 -3
- data/lib/fluent/plugin/gelf_plugin_util.rb +4 -9
- data/lib/fluent/plugin/out_gelf.rb +18 -6
- metadata +27 -19
- data/.gitignore +0 -4
- data/Gemfile +0 -3
- data/Rakefile +0 -11
- data/certs/oss@hotschedules.com.cert +0 -25
- data/fluent-plugin-gelf-best.gemspec +0 -24
- data/lib/fluent-plugin-gelf-best/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2455a3682f22df246b829bbc986cbe28d784858160ed40b2f2e2543fe6619f1b
|
4
|
+
data.tar.gz: 98ea9ddf2c37ccad0b440fb1956d19cafaef6fd22d4adc8c4d80caab74a30fe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39b5686fd08cf013b264febcc645fc79ab1df8b5cf9f63a62d800d32ac6ecde34efc70667508f047c882050f89460aa10e8c1aa6c57130d2e346ca785f6178c
|
7
|
+
data.tar.gz: 4fb1af6ee4509ea889a876b7af12819d82f71dc49582874023722e04817cd3eef72cacbd9742e62ea3874cff7fc1f2bdbd71f54bb0a2b6f6908480910b3844c3
|
data/README.md
CHANGED
@@ -27,6 +27,8 @@ For more info, review [Fluentd's official documentation](https://docs.fluentd.or
|
|
27
27
|
host <remote GELF host>
|
28
28
|
port <remote GELF port>
|
29
29
|
protocol <tcp or udp (default)>
|
30
|
+
udp_transport_type <LAN or WAN(default)>
|
31
|
+
max_bytes <maximum message size (3200 default)>
|
30
32
|
tls <true or false (default)>
|
31
33
|
tls_options <{} (default)> for options see https://github.com/graylog-labs/gelf-rb/blob/72916932b789f7a6768c3cdd6ab69a3c942dbcef/lib/gelf/transport/tcp_tls.rb#L7-L12
|
32
34
|
[ fluent buffered output plugin configuration ]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "fluent/plugin/formatter"
|
2
2
|
require "fluent/plugin/gelf_plugin_util"
|
3
|
-
require
|
3
|
+
require 'oj'
|
4
4
|
|
5
5
|
module Fluent
|
6
6
|
module TextFormatter
|
@@ -16,6 +16,7 @@ module Fluent
|
|
16
16
|
|
17
17
|
config_param :use_record_host, :bool, :default => true
|
18
18
|
config_param :add_msec_time, :bool, :default => false
|
19
|
+
config_param :max_bytes, :integer, :default => 32000
|
19
20
|
|
20
21
|
def configure(conf)
|
21
22
|
super(conf)
|
@@ -29,11 +30,12 @@ module Fluent
|
|
29
30
|
tag,time,record,
|
30
31
|
{
|
31
32
|
:use_record_host => @use_record_host,
|
32
|
-
:add_msec_time => @add_msec_time
|
33
|
+
:add_msec_time => @add_msec_time,
|
34
|
+
:max_bytes => @max_bytes
|
33
35
|
}
|
34
36
|
)
|
35
37
|
|
36
|
-
|
38
|
+
Oj.dump(gelfentry)
|
37
39
|
|
38
40
|
rescue Exception => e
|
39
41
|
log.error sprintf(
|
@@ -15,7 +15,7 @@ module Fluent
|
|
15
15
|
}.freeze
|
16
16
|
|
17
17
|
def make_gelfentry(tag, time, record, conf = {})
|
18
|
-
gelfentry = {'_fluentd_tag' => tag, 'timestamp' =>
|
18
|
+
gelfentry = {'_fluentd_tag' => tag, 'timestamp' => time}
|
19
19
|
|
20
20
|
record.each_pair do |k, v|
|
21
21
|
gelfentry.merge!(process_record_entry(k, v, conf, gelfentry))
|
@@ -27,15 +27,10 @@ module Fluent
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def calculate_timestamp(time)
|
31
|
-
if defined?(Fluent::EventTime) && time.is_a?(Fluent::EventTime)
|
32
|
-
time.sec + (time.nsec.to_f / 1_000_000_000).round(3)
|
33
|
-
else
|
34
|
-
time
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
30
|
def process_record_entry(k, v, conf, gelfentry)
|
31
|
+
# Truncate values longer than max_bytes
|
32
|
+
v = (v.respond_to?(:bytesize) && v.bytesize > conf[:max_bytes]) ? "#{v.byteslice(0, conf[:max_bytes] - 3)}..." : v
|
33
|
+
|
39
34
|
case k
|
40
35
|
when 'host', 'hostname'
|
41
36
|
return {'host' => (conf[:use_record_host] ? v : gelfentry['_host'] = v)}
|
@@ -10,9 +10,11 @@ module Fluent
|
|
10
10
|
|
11
11
|
config_param :use_record_host, :bool, :default => false
|
12
12
|
config_param :add_msec_time, :bool, :default => false
|
13
|
+
config_param :max_bytes, :integer, :default => 32000
|
13
14
|
config_param :host, :string, :default => nil
|
14
15
|
config_param :port, :integer, :default => 12201
|
15
16
|
config_param :protocol, :string, :default => 'udp'
|
17
|
+
config_param :udp_transport_type, :string, :default => 'WAN'
|
16
18
|
config_param :tls, :bool, :default => false
|
17
19
|
config_param :tls_options, :hash, :default => {}
|
18
20
|
|
@@ -44,11 +46,20 @@ module Fluent
|
|
44
46
|
# a destination hostname or IP address must be provided
|
45
47
|
raise Fluent::ConfigError.new("'host' parameter (hostname or address of Graylog2 server) is required") unless conf.has_key?('host')
|
46
48
|
|
49
|
+
# validate udp_transport_type if protocol is udp
|
50
|
+
if @protocol == 'udp'
|
51
|
+
unless %w[WAN LAN].include?(@udp_transport_type)
|
52
|
+
raise Fluent::ConfigError.new("'udp_transport_type' parameter should be either 'WAN' or 'LAN'")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
47
56
|
# choose protocol to pass to gelf-rb Notifier constructor
|
48
|
-
|
49
|
-
|
50
|
-
elsif @protocol == 'tcp'
|
51
|
-
|
57
|
+
if @protocol == 'udp'
|
58
|
+
@proto = GELF::Protocol::UDP
|
59
|
+
elsif @protocol == 'tcp'
|
60
|
+
@proto = GELF::Protocol::TCP
|
61
|
+
else
|
62
|
+
raise Fluent::ConfigError.new("'protocol' parameter should be either 'udp' (default) or 'tcp'")
|
52
63
|
end
|
53
64
|
end
|
54
65
|
|
@@ -63,7 +74,7 @@ module Fluent
|
|
63
74
|
options[:tls] = @tls_options
|
64
75
|
end
|
65
76
|
|
66
|
-
@conn = GELF::Notifier.new(@host, @port,
|
77
|
+
@conn = GELF::Notifier.new(@host, @port, @udp_transport_type, options)
|
67
78
|
|
68
79
|
# Errors are not coming from Ruby so we use direct mapping
|
69
80
|
@conn.level_mapping = 'direct'
|
@@ -87,7 +98,8 @@ module Fluent
|
|
87
98
|
tag,timestamp,record,
|
88
99
|
{
|
89
100
|
:use_record_host => @use_record_host,
|
90
|
-
:add_msec_time => @add_msec_time
|
101
|
+
:add_msec_time => @add_msec_time,
|
102
|
+
:max_bytes => @max_bytes
|
91
103
|
}
|
92
104
|
).to_msgpack
|
93
105
|
rescue Exception => e
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gelf-best
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Yamauchi
|
8
8
|
- Eric Searcy
|
9
|
-
- Bartosz
|
10
|
-
autorequire:
|
9
|
+
- Bartosz Michalkiewicz
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-03-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|
@@ -18,28 +18,42 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.8.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name:
|
30
|
+
name: gelf_redux
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 4.1.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 4.1.0
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: oj
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
43
57
|
- !ruby/object:Gem::Dependency
|
44
58
|
name: test-unit
|
45
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,21 +82,15 @@ dependencies:
|
|
68
82
|
- - ">="
|
69
83
|
- !ruby/object:Gem::Version
|
70
84
|
version: '0'
|
71
|
-
description:
|
85
|
+
description:
|
72
86
|
email:
|
73
87
|
- bartosz.michalkiewicz@outlook.com
|
74
88
|
executables: []
|
75
89
|
extensions: []
|
76
90
|
extra_rdoc_files: []
|
77
91
|
files:
|
78
|
-
- ".gitignore"
|
79
|
-
- Gemfile
|
80
92
|
- LICENSE
|
81
93
|
- README.md
|
82
|
-
- Rakefile
|
83
|
-
- certs/oss@hotschedules.com.cert
|
84
|
-
- fluent-plugin-gelf-best.gemspec
|
85
|
-
- lib/fluent-plugin-gelf-best/version.rb
|
86
94
|
- lib/fluent/plugin/formatter_gelf.rb
|
87
95
|
- lib/fluent/plugin/gelf_plugin_util.rb
|
88
96
|
- lib/fluent/plugin/out_gelf.rb
|
@@ -90,7 +98,7 @@ homepage: https://github.com/bmichalkiewicz/fluent-plugin-gelf-best
|
|
90
98
|
licenses:
|
91
99
|
- Apache-2.0
|
92
100
|
metadata: {}
|
93
|
-
post_install_message:
|
101
|
+
post_install_message:
|
94
102
|
rdoc_options: []
|
95
103
|
require_paths:
|
96
104
|
- lib
|
@@ -105,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
113
|
- !ruby/object:Gem::Version
|
106
114
|
version: '0'
|
107
115
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
116
|
+
rubygems_version: 3.4.20
|
117
|
+
signing_key:
|
110
118
|
specification_version: 4
|
111
119
|
summary: Sends Fluentd events Graylog2 by GELF
|
112
120
|
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIELzCCAxGgAwIBAgIJAMOoRmNuvAZcMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYD
|
3
|
-
VQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5j
|
4
|
-
aXNjbzEVMBMGA1UECgwMSG90c2NoZWR1bGVzMQ4wDAYDVQQLDAVJbmZyYTEfMB0G
|
5
|
-
A1UEAwwWaW5mcmEuaG90c2NoZWR1bGVzLmNvbTEjMCEGCSqGSIb3DQEJARYUb3Nz
|
6
|
-
QGhvdHNjaGVkdWxlcy5jb20wHhcNMTcwMjE4MDA1NDU4WhcNMjEwMjE4MDA1NDU4
|
7
|
-
WjCBpzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcM
|
8
|
-
DV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KZwmmtx+BV2
|
23
|
-
GJevNV8BSuhh6m2AHCxEzMaD7WKNbewTTgGLUlvppaR9SE2V/yUZ7x1Vp8/mGeO6
|
24
|
-
2Zk648Ep9HVPKmwoVuB75+xEQw==
|
25
|
-
-----END CERTIFICATE-----
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'fluent-plugin-gelf-best/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "fluent-plugin-gelf-best"
|
8
|
-
spec.version = FluentPluginGelfBest::VERSION
|
9
|
-
spec.authors = ["Alex Yamauchi", "Eric Searcy", "Bartosz Michaliewicz"]
|
10
|
-
spec.licenses = ["Apache-2.0"]
|
11
|
-
spec.email = ["bartosz.michalkiewicz@outlook.com"]
|
12
|
-
|
13
|
-
spec.summary = "Sends Fluentd events Graylog2 by GELF"
|
14
|
-
spec.homepage = "https://github.com/bmichalkiewicz/fluent-plugin-gelf-best"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
-
spec.require_paths = ["lib"]
|
19
|
-
|
20
|
-
spec.add_runtime_dependency "fluentd", ">=1.0.0"
|
21
|
-
spec.add_runtime_dependency "gelf", ">= 2.0.0"
|
22
|
-
spec.add_development_dependency "test-unit"
|
23
|
-
spec.add_development_dependency "rake"
|
24
|
-
end
|