Skip to content

Commit 5d55414

Browse files
Merge pull request #326 from gliderlabs/master
release v3.2.3
2 parents d8d4786 + ee9134b commit 5d55414

File tree

6 files changed

+25
-13
lines changed

6 files changed

+25
-13
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ All notable changes to this project will be documented in this file.
1010

1111
### Changed
1212

13+
## [v3.2.3] - 2017-09-23
14+
### Added
15+
- @guigouz guigouz Add `RAW_FORMAT` to the documentation
16+
- @stevecalvert Allow docker log tail to be specified, default to 'all
17+
18+
### Fixed
19+
- @jeanlouisboudart RawTerminal should be set to true if we want to collect tty logs
20+
- @michaelshobbs fix new golint lintballs
1321

1422
## [v3.2.2] - 2017-05-25
1523
### Fixed
@@ -154,7 +162,9 @@ All notable changes to this project will be documented in this file.
154162
- Base container is now Alpine
155163
- Moved to gliderlabs organization
156164

157-
[unreleased]: https://github.com/gliderlabs/logspout/compare/v3.2.1...HEAD
165+
[unreleased]: https://github.com/gliderlabs/logspout/compare/v3.2.3...HEAD
166+
[v3.2.3]: https://github.com/gliderlabs/logspout/compare/v3.2.3...v3.2.3
167+
[v3.2.2]: https://github.com/gliderlabs/logspout/compare/v3.2.1...v3.2.2
158168
[v3.2.1]: https://github.com/gliderlabs/logspout/compare/v3.2...v3.2.1
159169
[v3.2]: https://github.com/gliderlabs/logspout/compare/v3.1...v3.2
160170
[v3.1]: https://github.com/gliderlabs/logspout/compare/v3...v3.1

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ You can route to multiple destinations by comma-separating the URIs:
8888
raw://192.168.10.10:5000?filter.name=*_db,syslog+tls://logs.papertrailapp.com:55555?filter.name=*_app
8989

9090
#### Suppressing backlog tail
91-
You can tell logspout to only display log entries since container "start" or "restart" event by setting a `BACKLOG=false` environment variable (equivalent to `docker logs --tail=0`):
91+
You can tell logspout to only display log entries since container "start" or "restart" event by setting a `BACKLOG=false` environment variable (equivalent to `docker logs --since=0s`):
9292

9393
$ docker run -d --name="logspout" \
9494
-e 'BACKLOG=false' \
@@ -99,6 +99,10 @@ The default behaviour is to output all logs since creation of the container (equ
9999

100100
> NOTE: Use of this option **may** cause the first few lines of log output to be missed following a container being started, if the container starts outputting logs before logspout has a chance to see them. If consistent capture of *every* line of logs is critical to your application, you might want to test thorougly and/or avoid this option (at the expense of getting the entire backlog for every restarting container). This does not affect containers that are removed and recreated.
101101
102+
103+
#### Environment variable, TAIL
104+
Whilst BACKLOG=false restricts the tail by setting the Docker Logs.Options.Since to time.Now(), another mechanism to restrict the tail is to set TAIL=n. Use of this mechanism avoids parsing the earlier content of the logfile which may have a speed advantage if the tail content is of no interest or has become corrupted.
105+
102106
#### Inspect log streams using curl
103107

104108
Using the [httpstream module](http://github.com/gliderlabs/logspout/blob/master/httpstream), you can connect with curl to see your local aggregated logs in realtime. You can do this without setting up a route URI.
@@ -135,10 +139,12 @@ Logspout relies on the Docker API to retrieve container logs. A failure in the A
135139

136140
* `ALLOW_TTY` - include logs from containers started with `-t` or `--tty` (i.e. `Allocate a pseudo-TTY`)
137141
* `BACKLOG` - suppress container tail backlog
142+
* `TAIL` - specify the number of lines in the log tail to capture when logspout starts (default `all`)
138143
* `DEBUG` - emit debug logs
139144
* `EXCLUDE_LABEL` - exclude logs with a given label
140145
* `INACTIVITY_TIMEOUT` - detect hang in Docker API (default 0)
141146
* `PORT` or `HTTP_PORT` - configure which port to listen on (default 80)
147+
* `RAW_FORMAT` - log format for the raw adapter (default `{{.Data}}\n`)
142148
* `RETRY_COUNT` - how many times to retry a broken socket (default 10)
143149
* `ROUTESPATH` - path to routes (default `/mnt/routes`)
144150
* `SYSLOG_DATA` - datum for data field (default `{{.Data}}`)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.2.2
1+
v3.3-dev

router/persist.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,5 @@ func marshal(obj interface{}) []byte {
7474

7575
func unmarshal(input io.Reader, obj interface{}) error {
7676
dec := json.NewDecoder(input)
77-
if err := dec.Decode(obj); err != nil {
78-
return err
79-
}
80-
return nil
77+
return dec.Decode(obj)
8178
}

router/pump.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func (p *LogsPump) pumpLogs(event *docker.APIEvents, backlog bool, inactivityTim
195195
return
196196
}
197197

198+
var tail = getopt("TAIL", "all")
198199
var sinceTime time.Time
199200
if backlog {
200201
sinceTime = time.Unix(0, 0)
@@ -215,17 +216,18 @@ func (p *LogsPump) pumpLogs(event *docker.APIEvents, backlog bool, inactivityTim
215216
p.update(event)
216217
go func() {
217218
for {
218-
debug("pump.pumpLogs():", id, "started")
219+
debug("pump.pumpLogs():", id, "started, tail:", tail)
219220
err := p.client.Logs(docker.LogsOptions{
220221
Container: id,
221222
OutputStream: outwr,
222223
ErrorStream: errwr,
223224
Stdout: true,
224225
Stderr: true,
225226
Follow: true,
226-
Tail: "all",
227+
Tail: tail,
227228
Since: sinceTime.Unix(),
228229
InactivityTimeout: inactivityTimeout,
230+
RawTerminal: allowTTY,
229231
})
230232
if err != nil {
231233
debug("pump.pumpLogs():", id, "stopped with error:", err)

routesapi/routesapi.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,5 @@ func marshal(obj interface{}) []byte {
7272

7373
func unmarshal(input io.Reader, obj interface{}) error {
7474
dec := json.NewDecoder(input)
75-
if err := dec.Decode(obj); err != nil {
76-
return err
77-
}
78-
return nil
75+
return dec.Decode(obj)
7976
}

0 commit comments

Comments
 (0)