lib/remote_syslog/reader.rb in remote_syslog-1.6.4 vs lib/remote_syslog/reader.rb in remote_syslog-1.6.4.1
- old
+ new
@@ -40,15 +40,19 @@
@packet.hostname = local_hostname
@packet.facility = options[:facility] || 'user'
@packet.severity = options[:severity] || 'notice'
- tag = options[:program] || File.basename(path) || File.basename($0)
+ tag = options[:program] || File.basename(path) || File.basename($0)
+ # Remove characters that can't be in a tag
+ tag = tag.gsub(%r{[: \]\[\\]+}, '-')
+
# Make sure the tag isn't too long
if tag.length > 32
tag = tag[0..31]
end
+
@packet.tag = tag
end
def receive_data(data)
@buffer.extract(data).each do |line|