fluent-plugin-gelf-hs 1.0.4 → 1.0.5

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.
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
- gelfentry = make_gelfentry(
21
- tag,time,record,
22
- {
23
- :use_record_host => @use_record_host,
24
- :add_msec_time => @add_msec_time
25
- }
26
- )
27
-
28
- make_json(gelfentry,{})
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
- make_gelfentry(
68
- tag,time,record,
69
- {
70
- :use_record_host => @use_record_host,
71
- :add_msec_time => @add_msec_time
72
- }
73
- ).to_msgpack
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
- @conn.notify!(data)
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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
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: 2017-08-08 00:00:00 Z
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