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
14 changes: 9 additions & 5 deletions lib/fluentd/plugin/out_syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ def emit(tag, es, chain)
time = Time.now
end
@packet.time = time
@packet.tag = if tag_key
record[tag_key][0..31].gsub(/[\[\]]/,'') # tag is trimmed to 32 chars for syslog_protocol gem compatibility
else
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
@packet.tag = if @tag_key
begin
record[@tag_key][0..31].gsub(/[\[\]]/,'') # tag is trimmed to 32 chars for syslog_protocol gem compatibility
rescue
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
else
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
packet = @packet.dup
packet.content = record[@payload_key]
@socket.send(packet.assemble, 0, @remote_syslog, @port)
Expand Down
14 changes: 9 additions & 5 deletions lib/fluentd/plugin/out_syslog_buffered.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ def send_to_syslog(tag, time, record)
time = Time.now
end
@packet.time = time
@packet.tag = if tag_key
record[tag_key][0..31].gsub(/[\[\]]/,'') # tag is trimmed to 32 chars for syslog_protocol gem compatibility
else
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
@packet.tag = if @tag_key
begin
record[@tag_key][0..31].gsub(/[\[\]]/,'') # tag is trimmed to 32 chars for syslog_protocol gem compatibility
rescue
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
else
tag[0..31] # tag is trimmed to 32 chars for syslog_protocol gem compatibility
end
packet = @packet.dup
packet.content = record[@payload_key]
begin
Expand Down