Skip to content

Commit

Permalink
fix: use newline delimited protocol instead of octet counting
Browse files Browse the repository at this point in the history
`rsyslog` marks that this is most common protocol and it is the only one
supported by them.
  • Loading branch information
hauleth committed May 20, 2024
1 parent 04b3d60 commit 8f3e5a3
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/logflare/backends/adaptor/tcp_adaptor/syslog.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ defmodule Logflare.Backends.Adaptor.TCPAdaptor.Syslog do
@moduledoc """
Implementation of [RFC5424 The Syslog Protocol][]
This implementation uses *Octet Counting* framing from [RFC6587][]
[RFC5424]: https://www.rfc-editor.org/rfc/rfc5424
[RFC6587]: https://www.rfc-editor.org/rfc/rfc6587#section-3.4.1
"""

alias Logflare.LogEvent
Expand All @@ -14,18 +11,14 @@ defmodule Logflare.Backends.Adaptor.TCPAdaptor.Syslog do
@pen 2137

def format(%LogEvent{} = le, options) do
body = [
[
header(le, options),
" ",
structured_data(le, options),
" ",
Jason.encode!(le.body),
"\n"
]

len = IO.iodata_length(body)

[Integer.to_string(len), " ", body]
end

defp header(%LogEvent{} = le, options) do
Expand Down

0 comments on commit 8f3e5a3

Please sign in to comment.