fluent-plugin-gelf-hs 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/lib/fluent/plugin/formatter_gelf.rb +24 -9
- data/lib/fluent/plugin/out_gelf.rb +29 -8
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
@@ -4,6 +4,10 @@ module Fluent
|
|
4
4
|
module TextFormatter
|
5
5
|
class GELFFormatter < Formatter
|
6
6
|
|
7
|
+
unless method_defined?(:log)
|
8
|
+
define_method('log') { $log }
|
9
|
+
end
|
10
|
+
|
7
11
|
Plugin.register_formatter("gelf", self)
|
8
12
|
|
9
13
|
require 'fluent/gelf_util'
|
@@ -17,15 +21,26 @@ module Fluent
|
|
17
21
|
end
|
18
22
|
|
19
23
|
def format(tag, time, record)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
|
25
|
+
begin
|
26
|
+
|
27
|
+
gelfentry = make_gelfentry(
|
28
|
+
tag,time,record,
|
29
|
+
{
|
30
|
+
:use_record_host => @use_record_host,
|
31
|
+
:add_msec_time => @add_msec_time
|
32
|
+
}
|
33
|
+
)
|
34
|
+
|
35
|
+
make_json(gelfentry,{})
|
36
|
+
|
37
|
+
rescue Exception => e
|
38
|
+
log.error sprintf(
|
39
|
+
'Error trying to serialize %s: %s',
|
40
|
+
record.to_s.force_encoding('UTF-8'),
|
41
|
+
e.message.to_s.force_encoding('UTF-8')
|
42
|
+
)
|
43
|
+
end
|
29
44
|
end
|
30
45
|
|
31
46
|
end
|
@@ -2,6 +2,10 @@ module Fluent
|
|
2
2
|
|
3
3
|
class GELFOutput < BufferedOutput
|
4
4
|
|
5
|
+
unless method_defined?(:log)
|
6
|
+
define_method('log') { $log }
|
7
|
+
end
|
8
|
+
|
5
9
|
Plugin.register_output("gelf", self)
|
6
10
|
|
7
11
|
require 'gelf'
|
@@ -64,19 +68,36 @@ module Fluent
|
|
64
68
|
timestamp = time
|
65
69
|
end
|
66
70
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
begin
|
72
|
+
make_gelfentry(
|
73
|
+
tag,time,record,
|
74
|
+
{
|
75
|
+
:use_record_host => @use_record_host,
|
76
|
+
:add_msec_time => @add_msec_time
|
77
|
+
}
|
78
|
+
).to_msgpack
|
79
|
+
rescue Exception => e
|
80
|
+
log.error sprintf(
|
81
|
+
'Error trying to serialize %s: %s',
|
82
|
+
record.to_s.force_encoding('UTF-8'),
|
83
|
+
e.message.to_s.force_encoding('UTF-8')
|
84
|
+
)
|
85
|
+
end
|
74
86
|
|
75
87
|
end
|
76
88
|
|
77
89
|
def write(chunk)
|
78
90
|
chunk.msgpack_each do |data|
|
79
|
-
|
91
|
+
begin
|
92
|
+
@conn.notify!(data)
|
93
|
+
rescue Exception => e
|
94
|
+
log.error sprintf(
|
95
|
+
'Error trying to publish %s: %s',
|
96
|
+
data.to_s.force_encoding('UTF-8'),
|
97
|
+
e.message.to_s.force_encoding('UTF-8')
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
80
101
|
end
|
81
102
|
end
|
82
103
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gelf-hs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 5
|
10
|
+
version: 1.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Yamauchi
|
@@ -42,7 +42,7 @@ cert_chain:
|
|
42
42
|
2Zk648Ep9HVPKmwoVuB75+xEQw==
|
43
43
|
-----END CERTIFICATE-----
|
44
44
|
|
45
|
-
date:
|
45
|
+
date: 2018-04-09 00:00:00 Z
|
46
46
|
dependencies:
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: fluentd
|
metadata.gz.sig
CHANGED
Binary file
|