Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/fluentd/plugin/out_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def configure(conf)
@facilty = conf['facility']
@severity = conf['severity']
@use_record = conf['use_record']
@cee_record = conf['cee_record']
@payload_key = conf['payload_key']
if not @payload_key
@payload_key = "message"
Expand Down Expand Up @@ -84,7 +85,11 @@ def emit(tag, es, chain)
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
packet = @packet.dup
packet.content = record[@payload_key]
if @cee_record
packet.content = "@cee:" + record.to_json
else
packet.content = record[@payload_key]
end
@socket.send(packet.assemble, 0, @remote_syslog, @port)
}
end
Expand Down
8 changes: 7 additions & 1 deletion lib/fluentd/plugin/out_syslog_buffered.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SyslogBufferedOutput < Fluent::BufferedOutput
config_param :severity, :string, :default => 'debug'
config_param :use_record, :string, :default => nil
config_param :payload_key, :string, :default => 'message'
config_param :cee_record, :string, :default => nil


def initialize
Expand All @@ -38,6 +39,7 @@ def configure(conf)
@facilty = conf['facility']
@severity = conf['severity']
@use_record = conf['use_record']
@cee_record = conf['cee_record']
@payload_key = conf['payload_key']
if not @payload_key
@payload_key = "message"
Expand Down Expand Up @@ -108,7 +110,11 @@ def send_to_syslog(tag, time, record)
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
packet = @packet.dup
packet.content = record[@payload_key]
if @cee_record
packet.content = "@cee:" + record.to_json
else
packet.content = record[@payload_key]
end
begin
if not @socket
@socket = create_tcp_socket(@remote_syslog, @port)
Expand Down