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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 3.8.0
- Added support for transparent framing / octet-counting. See [RFC 6587 section 3.4.1](https://www.ietf.org/rfc/rfc6587.txt)

## 3.7.1
- Fix issue where the priority field was not being set correctly when grok failed [#76](https://github.com/logstash-plugins/logstash-input-syslog/pull/78)

Expand Down
3 changes: 2 additions & 1 deletion docs/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ supports `RFC3164` syslog with some small modifications. However, some
non-standard syslog formats can be read and parsed if a functional
`grok_pattern` is provided. The date format is still only allowed to be
`RFC3164` style or `ISO8601`.
This input supports UDP and TCP. Both TCP transparent and non-transparent framming are supported.

For more information see the http://www.ietf.org/rfc/rfc3164.txt[RFC3164 page].
For more information on syslog see the http://www.ietf.org/rfc/rfc3164.txt[RFC3164 page] and for more information on TCP framing see the https://www.ietf.org/rfc/rfc6587.txt[RFC 6587 page].

Note: This input will start listeners on both TCP and UDP.

Expand Down
34 changes: 29 additions & 5 deletions lib/logstash/inputs/syslog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,40 @@ def tcp_read_lines(socket)
buffer = String.new
loop do
begin
buffer << socket.read_nonblock(1024)
while (newline = buffer.index("\n"))
yield buffer.slice!(0..newline)
end
buffer << socket.read_nonblock(1)
break if buffer.length >= 1
rescue IO::WaitReadable
IO.select([socket], nil)
retry
end
end
end
if buffer[0].match?(/\d/) #Check if the first char is a digit
loop do
begin
buffer << socket.read_nonblock(16)
first_space = buffer.index(" ")
log_len = Integer(buffer.slice!(0..first_space))
Comment on lines +237 to +242
buffer << socket.read_nonblock(log_len-buffer.length)
yield buffer.slice!(0..log_len)
rescue IO::WaitReadable
IO.select([socket], nil)
retry
end
end
else
loop do
begin
buffer << socket.read_nonblock(1024)
while (newline = buffer.index("\n"))
yield buffer.slice!(0..newline)
end
rescue IO::WaitReadable
IO.select([socket], nil)
retry
end
end
end
end

# tcp_receiver is executed in a thread, any uncatched exception will be bubbled up to the
# tcp server thread and all tcp connections will be closed and the listener restarted.
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.1
3.8.0