fluent-plugin-gelf-test 1.4.1 → 1.4.3
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/lib/fluent/plugin/formatter_gelf.rb +6 -5
- data/lib/fluent/plugin/gelf_plugin_util.rb +1 -10
- data/lib/fluent/plugin/out_gelf.rb +21 -8
- metadata +12 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1408d928adbef9988d61d6b26f28cca70faa0f4b741c96f5fa088809c2aae5e
|
4
|
+
data.tar.gz: 49e761a209740b73c76089dd795ec34a8734359e4641348586a2b4b78c8db7a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 061a64fd057e3d704f3cf8555adbf96ca58270b41893852eb23bc5e138ca9f91acb575dc426d98f3dd047548b1b7fdf283808c6e51114243c7fb2fb50328aac7
|
7
|
+
data.tar.gz: 1f8ed1a5a8200ae44b95c515e4e4ba2b9c4a0f111e41c1454ee864002728fa328befbf5b64def806acef781674ec2413cbae6b88942b526e945903d5a789f8c8
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# typed: false
|
2
1
|
require "fluent/plugin/formatter"
|
3
2
|
require "fluent/plugin/gelf_plugin_util"
|
4
3
|
require 'oj'
|
@@ -24,13 +23,15 @@ module Fluent
|
|
24
23
|
end
|
25
24
|
|
26
25
|
def format(tag, time, record)
|
26
|
+
|
27
27
|
begin
|
28
|
+
|
28
29
|
gelfentry = make_gelfentry(
|
29
|
-
tag,
|
30
|
+
tag,time,record,
|
30
31
|
{
|
31
|
-
use_record_host
|
32
|
-
add_msec_time
|
33
|
-
max_bytes
|
32
|
+
:use_record_host => @use_record_host,
|
33
|
+
:add_msec_time => @add_msec_time,
|
34
|
+
:max_bytes => @max_bytes
|
34
35
|
}
|
35
36
|
)
|
36
37
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# typed: false
|
2
1
|
module Fluent
|
3
2
|
module GelfPluginUtil
|
4
3
|
require "gelf"
|
@@ -16,7 +15,7 @@ module Fluent
|
|
16
15
|
}.freeze
|
17
16
|
|
18
17
|
def make_gelfentry(tag, time, record, conf = {})
|
19
|
-
gelfentry = {'_fluentd_tag' => tag, 'timestamp' =>
|
18
|
+
gelfentry = {'_fluentd_tag' => tag, 'timestamp' => time}
|
20
19
|
|
21
20
|
record.each_pair do |k, v|
|
22
21
|
gelfentry.merge!(process_record_entry(k, v, conf, gelfentry))
|
@@ -28,14 +27,6 @@ module Fluent
|
|
28
27
|
|
29
28
|
private
|
30
29
|
|
31
|
-
def calculate_timestamp(time)
|
32
|
-
if defined?(Fluent::EventTime) && time.is_a?(Fluent::EventTime)
|
33
|
-
time.sec + (time.nsec.to_f / 1_000_000_000).round(3)
|
34
|
-
else
|
35
|
-
time
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
30
|
def process_record_entry(k, v, conf, gelfentry)
|
40
31
|
# Truncate values longer than max_bytes
|
41
32
|
v = (v.respond_to?(:bytesize) && v.bytesize > conf[:max_bytes]) ? "#{v.byteslice(0, conf[:max_bytes] - 3)}..." : v
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# typed: true
|
2
1
|
require "fluent/plugin/output"
|
3
2
|
require "fluent/plugin/gelf_plugin_util"
|
4
3
|
|
@@ -15,7 +14,7 @@ module Fluent
|
|
15
14
|
config_param :host, :string, :default => nil
|
16
15
|
config_param :port, :integer, :default => 12201
|
17
16
|
config_param :protocol, :string, :default => 'udp'
|
18
|
-
config_param :
|
17
|
+
config_param :udp_transport_type, :string, :default => 'LAN'
|
19
18
|
config_param :tls, :bool, :default => false
|
20
19
|
config_param :tls_options, :hash, :default => {}
|
21
20
|
|
@@ -47,11 +46,20 @@ module Fluent
|
|
47
46
|
# a destination hostname or IP address must be provided
|
48
47
|
raise Fluent::ConfigError.new("'host' parameter (hostname or address of Graylog2 server) is required") unless conf.has_key?('host')
|
49
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
|
+
|
50
56
|
# choose protocol to pass to gelf-rb Notifier constructor
|
51
|
-
|
52
|
-
|
53
|
-
elsif @protocol == 'tcp'
|
54
|
-
|
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'")
|
55
63
|
end
|
56
64
|
end
|
57
65
|
|
@@ -66,7 +74,7 @@ module Fluent
|
|
66
74
|
options[:tls] = @tls_options
|
67
75
|
end
|
68
76
|
|
69
|
-
@conn = GELF::Notifier.new(@host, @port, @
|
77
|
+
@conn = GELF::Notifier.new(@host, @port, @udp_transport_type, options)
|
70
78
|
|
71
79
|
# Errors are not coming from Ruby so we use direct mapping
|
72
80
|
@conn.level_mapping = 'direct'
|
@@ -79,10 +87,15 @@ module Fluent
|
|
79
87
|
end
|
80
88
|
|
81
89
|
def format(tag, time, record)
|
90
|
+
if defined? Fluent::EventTime and time.is_a? Fluent::EventTime then
|
91
|
+
timestamp = time.to_i + (time.nsec.to_f/1000000000).round(3)
|
92
|
+
else
|
93
|
+
timestamp = time.to_i
|
94
|
+
end
|
82
95
|
|
83
96
|
begin
|
84
97
|
make_gelfentry(
|
85
|
-
tag,
|
98
|
+
tag,timestamp,record,
|
86
99
|
{
|
87
100
|
:use_record_host => @use_record_host,
|
88
101
|
:add_msec_time => @add_msec_time,
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gelf-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Yamauchi
|
8
8
|
- Eric Searcy
|
9
9
|
- Bartosz Michaliewicz
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-03-
|
13
|
+
date: 2025-03-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: fluentd
|
@@ -30,38 +30,24 @@ dependencies:
|
|
30
30
|
name: gelf_redux
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- - "
|
33
|
+
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
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
42
|
version: 4.1.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: oj
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 3.16.9
|
50
|
-
type: :runtime
|
51
|
-
prerelease: false
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
53
|
-
requirements:
|
54
|
-
- - "~>"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 3.16.9
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: test-unit
|
59
45
|
requirement: !ruby/object:Gem::Requirement
|
60
46
|
requirements:
|
61
47
|
- - ">="
|
62
48
|
- !ruby/object:Gem::Version
|
63
49
|
version: '0'
|
64
|
-
type: :
|
50
|
+
type: :runtime
|
65
51
|
prerelease: false
|
66
52
|
version_requirements: !ruby/object:Gem::Requirement
|
67
53
|
requirements:
|
@@ -69,7 +55,7 @@ dependencies:
|
|
69
55
|
- !ruby/object:Gem::Version
|
70
56
|
version: '0'
|
71
57
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
58
|
+
name: test-unit
|
73
59
|
requirement: !ruby/object:Gem::Requirement
|
74
60
|
requirements:
|
75
61
|
- - ">="
|
@@ -83,7 +69,7 @@ dependencies:
|
|
83
69
|
- !ruby/object:Gem::Version
|
84
70
|
version: '0'
|
85
71
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
72
|
+
name: rake
|
87
73
|
requirement: !ruby/object:Gem::Requirement
|
88
74
|
requirements:
|
89
75
|
- - ">="
|
@@ -96,7 +82,7 @@ dependencies:
|
|
96
82
|
- - ">="
|
97
83
|
- !ruby/object:Gem::Version
|
98
84
|
version: '0'
|
99
|
-
description:
|
85
|
+
description:
|
100
86
|
email:
|
101
87
|
- bartosz.michalkiewicz@outlook.com
|
102
88
|
executables: []
|
@@ -112,7 +98,7 @@ homepage: https://github.com/bmichalkiewicz/fluent-plugin-gelf-best
|
|
112
98
|
licenses:
|
113
99
|
- Apache-2.0
|
114
100
|
metadata: {}
|
115
|
-
post_install_message:
|
101
|
+
post_install_message:
|
116
102
|
rdoc_options: []
|
117
103
|
require_paths:
|
118
104
|
- lib
|
@@ -127,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
113
|
- !ruby/object:Gem::Version
|
128
114
|
version: '0'
|
129
115
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
131
|
-
signing_key:
|
116
|
+
rubygems_version: 3.4.20
|
117
|
+
signing_key:
|
132
118
|
specification_version: 4
|
133
119
|
summary: Sends Fluentd events Graylog2 by GELF
|
134
120
|
test_files: []
|