Class: Fluent::Plugin::GelfOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::GelfOutput
show all
- Includes:
- GelfPluginUtil
- Defined in:
- lib/fluent/plugin/out_gelf.rb
Constant Summary
GelfPluginUtil::LEVEL_MAPPING, GelfPluginUtil::SYSLOG_FACILITY
Instance Method Summary
collapse
#make_gelfentry, #merge_inner_json
Instance Method Details
16
17
18
19
|
# File 'lib/fluent/plugin/out_gelf.rb', line 16
def configure(conf)
super
raise ConfigError, "'host' parameter is required" unless conf.key?("host")
end
|
29
30
31
|
# File 'lib/fluent/plugin/out_gelf.rb', line 29
def format(tag, time, record)
make_gelfentry(tag, time, record).to_msgpack
end
|
51
52
53
|
# File 'lib/fluent/plugin/out_gelf.rb', line 51
def formatted_to_msgpack_binary
true
end
|
#multi_workers_ready? ⇒ Boolean
55
56
57
|
# File 'lib/fluent/plugin/out_gelf.rb', line 55
def multi_workers_ready?
true
end
|
#shutdown ⇒ Object
25
26
27
|
# File 'lib/fluent/plugin/out_gelf.rb', line 25
def shutdown
super
end
|
#start ⇒ Object
21
22
23
|
# File 'lib/fluent/plugin/out_gelf.rb', line 21
def start
super
end
|
#write(chunk) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/fluent/plugin/out_gelf.rb', line 33
def write(chunk) records = []
chunk.msgpack_each do |record|
records.push JSON.dump(record) + "\0" end
log.debug "establishing connection with GrayLog"
socket = TCPSocket.new(@host, @port)
begin
log.debug "sending #{records.count} records in batch"
socket.write(records.join)
ensure
log.debug "closing connection with GrayLog"
socket.close
end
end
|