fluent-plugin-gelf-best 1.3.4 → 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 +2 -2
- data/lib/fluent/plugin/gelf_plugin_util.rb +1 -9
- data/lib/fluent/plugin/out_gelf.rb +15 -5
- metadata +22 -13
- data/.gitignore +0 -2
- data/Gemfile +0 -3
- data/Rakefile +0 -11
- 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
|
@@ -35,7 +35,7 @@ module Fluent
|
|
35
35
|
}
|
36
36
|
)
|
37
37
|
|
38
|
-
|
38
|
+
Oj.dump(gelfentry)
|
39
39
|
|
40
40
|
rescue Exception => e
|
41
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,14 +27,6 @@ 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)
|
39
31
|
# Truncate values longer than max_bytes
|
40
32
|
v = (v.respond_to?(:bytesize) && v.bytesize > conf[:max_bytes]) ? "#{v.byteslice(0, conf[:max_bytes] - 3)}..." : v
|
@@ -14,6 +14,7 @@ module Fluent
|
|
14
14
|
config_param :host, :string, :default => nil
|
15
15
|
config_param :port, :integer, :default => 12201
|
16
16
|
config_param :protocol, :string, :default => 'udp'
|
17
|
+
config_param :udp_transport_type, :string, :default => 'WAN'
|
17
18
|
config_param :tls, :bool, :default => false
|
18
19
|
config_param :tls_options, :hash, :default => {}
|
19
20
|
|
@@ -45,11 +46,20 @@ module Fluent
|
|
45
46
|
# a destination hostname or IP address must be provided
|
46
47
|
raise Fluent::ConfigError.new("'host' parameter (hostname or address of Graylog2 server) is required") unless conf.has_key?('host')
|
47
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
|
+
|
48
56
|
# choose protocol to pass to gelf-rb Notifier constructor
|
49
|
-
|
50
|
-
|
51
|
-
elsif @protocol == 'tcp'
|
52
|
-
|
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'")
|
53
63
|
end
|
54
64
|
end
|
55
65
|
|
@@ -64,7 +74,7 @@ module Fluent
|
|
64
74
|
options[:tls] = @tls_options
|
65
75
|
end
|
66
76
|
|
67
|
-
@conn = GELF::Notifier.new(@host, @port,
|
77
|
+
@conn = GELF::Notifier.new(@host, @port, @udp_transport_type, options)
|
68
78
|
|
69
79
|
# Errors are not coming from Ruby so we use direct mapping
|
70
80
|
@conn.level_mapping = 'direct'
|
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
|
9
|
+
- Bartosz Michalkiewicz
|
10
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
|
@@ -75,13 +89,8 @@ 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
|
-
- fluent-plugin-gelf-best.gemspec
|
84
|
-
- lib/fluent-plugin-gelf-best/version.rb
|
85
94
|
- lib/fluent/plugin/formatter_gelf.rb
|
86
95
|
- lib/fluent/plugin/gelf_plugin_util.rb
|
87
96
|
- lib/fluent/plugin/out_gelf.rb
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -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", ">= 3.1.0"
|
22
|
-
spec.add_development_dependency "test-unit"
|
23
|
-
spec.add_development_dependency "rake"
|
24
|
-
end
|