Skip to content

Commit

Permalink
Merge pull request #480 from gliderlabs/master
Browse files Browse the repository at this point in the history
release 3.2.11
  • Loading branch information
michaelshobbs authored May 8, 2020
2 parents 61a9913 + 301ffe1 commit 80b0f24
Show file tree
Hide file tree
Showing 8 changed files with 315 additions and 126 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ All notable changes to this project will be documented in this file.

### Changed

## [v3.2.11] - 2020-05-8
### Added
- @hhromic Add Syslog TCP framing documentation to README

### Changed
- @hhromic syslog adapter refactor
- @michaelshobbs use type assertion instead of reflection to determine connection type
- @michaelshobbs use // + space for all human readable comments

## [v3.2.10] - 2020-05-1
### Added
- @jszwedko Add optional TCP framing to syslog adapter
Expand Down Expand Up @@ -234,7 +243,8 @@ All notable changes to this project will be documented in this file.
- Base container is now Alpine
- Moved to gliderlabs organization

[unreleased]: https://github.com/gliderlabs/logspout/compare/v3.2.10...HEAD
[unreleased]: https://github.com/gliderlabs/logspout/compare/v3.2.11...HEAD
[v3.2.11]: https://github.com/gliderlabs/logspout/compare/v3.2.10...v3.2.11
[v3.2.10]: https://github.com/gliderlabs/logspout/compare/v3.2.9...v3.2.10
[v3.2.9]: https://github.com/gliderlabs/logspout/compare/v3.2.8...v3.2.9
[v3.2.8]: https://github.com/gliderlabs/logspout/compare/v3.2.7...v3.2.8
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ If you use multiline logging with raw, it's recommended to json encode the Data
* `SYSLOG_PRIORITY` - datum for priority field (default `{{.Priority}}`)
* `SYSLOG_STRUCTURED_DATA` - datum for structured data field
* `SYSLOG_TAG` - datum for tag field (default `{{.ContainerName}}+route.Options["append_tag"]`)
* `SYSLOG_TCP_FRAMING` - for TCP or TLS transports, whether to use `octet-counted` framing in emitted messages or `traditional` LF framing (default `traditional`)
* `SYSLOG_TIMESTAMP` - datum for timestamp field (default `{{.Timestamp}}`)
* `MULTILINE_ENABLE_DEFAULT` - enable multiline logging for all containers when using the multiline adapter (default `true`)
* `MULTILINE_MATCH` - determines which lines the pattern should match, one of first|last|nonfirst|nonlast, for details see: [MULTILINE_MATCH](#multiline_match) (default `nonfirst`)
Expand Down Expand Up @@ -250,6 +251,22 @@ Use examples:

```

#### Syslog TCP Framing

When using a TCP or TLS transport with the Syslog adapter, it is possible to add octet-counting to the emitted frames as described in [RFC6587 (Syslog over TCP) 3.4.1](https://tools.ietf.org/html/rfc6587#section-3.4.1) and [RFC5424 (Syslog over TLS)](https://tools.ietf.org/html/rfc5424).

This prefixes each message with the length of the message to allow consumers to easily determine where the message ends (rather than traditional LF framing). This also enables multiline Syslog messages without escaping.

To enable octet-counted framing for Syslog over TCP or TLS, use the `SYSLOG_TCP_FRAMING` environment variable:

$ docker run --name="logspout" \
-e SYSLOG_TCP_FRAMING=octet-counted \
--volume=/var/run/docker.sock:/var/run/docker.sock \
gliderlabs/logspout \
syslog+tcp://logs.papertrailapp.com:55555

> NOTE: The default is to use traditional LF framing for backwards compatibility though octet-counted framing is preferred when it is known the downstream consumer can handle it.
#### Using Logspout in a swarm

In a swarm, logspout is best deployed as a global service. When running logspout with 'docker run', you can change the value of the hostname field using the `SYSLOG_HOSTNAME` environment variable as explained above. However, this does not work in a compose file because the value for `SYSLOG_HOSTNAME` will be the same for all logspout "tasks", regardless of the docker host on which they run. To support this mode of deployment, the syslog adapter will look for the file `/etc/host_hostname` and, if the file exists and it is not empty, will configure the hostname field with the content of this file. You can then use a volume mount to map a file on the docker hosts with the file `/etc/host_hostname` in the container. The sample compose file below illustrates how this can be done
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.2.10
v3.2.11
4 changes: 1 addition & 3 deletions adapters/raw/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"log"
"net"
"os"
"reflect"
"text/template"

"github.com/gliderlabs/logspout/router"
Expand Down Expand Up @@ -69,11 +68,10 @@ func (a *Adapter) Stream(logstream chan *router.Message) {
log.Println("raw:", err)
return
}
//log.Println("debug:", buf.String())
_, err = a.conn.Write(buf.Bytes())
if err != nil {
log.Println("raw:", err)
if reflect.TypeOf(a.conn).String() != "*net.UDPConn" {
if _, ok := a.conn.(*net.UDPConn); !ok {
return
}
}
Expand Down
Loading

0 comments on commit 80b0f24

Please sign in to comment.