Skip to content

Commit 591787f

Browse files
Merge pull request #417 from gliderlabs/master
release 3.2.6
2 parents c9a891c + 4787cc5 commit 591787f

20 files changed

+529
-40
lines changed

CHANGELOG.md

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

1111
### Changed
1212

13+
## [v3.2.6] - 2018-10-04
14+
### Fixed
15+
- @jdgiotta Spelling corrections and fixed stack compose formatting in example
16+
- @dylanmei dylanmei Update 3rd party module link in README
17+
18+
### Added
19+
- @vbeausoleil added a simple healthcheck
20+
- @gbolo added option to load TLS client certificate and key
21+
- @gbolo added ability to control the TLS client trust store
22+
- @gbolo added option to harden the TLS client
23+
- @chopmann added option to bind the http server to an address
24+
- @ibrokethecloud added ability to add custom key:value pairs as EXCLUDE_LABEL
25+
26+
### Changed
27+
- @develar alpine 3.8 + golang 1.10.1
28+
- @gbolo enforced the use of `go 1.8+` in order to accommodate some TLS settings
29+
1330
## [v3.2.5] - 2018-06-05
1431
- @gmelika panic if reconnect fails
1532
- @masterada Added multiline adapter
@@ -182,7 +199,8 @@ All notable changes to this project will be documented in this file.
182199
- Base container is now Alpine
183200
- Moved to gliderlabs organization
184201

185-
[unreleased]: https://github.com/gliderlabs/logspout/compare/v3.2.5...HEAD
202+
[unreleased]: https://github.com/gliderlabs/logspout/compare/v3.2.6...HEAD
203+
[v3.2.6]: https://github.com/gliderlabs/logspout/compare/v3.2.5...v3.2.6
186204
[v3.2.5]: https://github.com/gliderlabs/logspout/compare/v3.2.4...v3.2.5
187205
[v3.2.4]: https://github.com/gliderlabs/logspout/compare/v3.2.3...v3.2.4
188206
[v3.2.3]: https://github.com/gliderlabs/logspout/compare/v3.2.2...v3.2.3

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.7
1+
FROM alpine:3.8
22
ENTRYPOINT ["/bin/logspout"]
33
VOLUME /mnt/routes
44
EXPOSE 80

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.6
1+
FROM alpine:3.8
22
VOLUME /mnt/routes
33
EXPOSE 80
44

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ test-tls:
7171
docker stop $(NAME)-tls || true
7272
docker rm $(NAME)-tls || true
7373

74+
test-healthcheck:
75+
docker run -d --name $(NAME)-healthcheck \
76+
-p 8000:80 \
77+
-v /var/run/docker.sock:/var/run/docker.sock \
78+
$(NAME):$(VERSION)
79+
sleep 2
80+
docker logs $(NAME)-healthcheck
81+
docker inspect --format='{{ .State.Running }}' $(NAME)-healthcheck | grep true
82+
curl --head --silent localhost:8000/health | grep "200 OK"
83+
docker stop $(NAME)-healthcheck || true
84+
docker rm $(NAME)-healthcheck || true
85+
7486
test-custom:
7587
docker run --name $(NAME)-custom $(NAME):custom || true
7688
docker logs $(NAME)-custom | grep -q logstash

README.md

Lines changed: 65 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ You can tell logspout to only display log entries since container "start" or "re
9797

9898
The default behaviour is to output all logs since creation of the container (equivalent to `docker logs --tail=all` or simply `docker logs`).
9999

100-
> 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.
100+
> 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 thoroughly 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
102102

103103
#### Environment variable, TAIL
@@ -157,7 +157,7 @@ Using the environment variable `MULTILINE_MATCH`=<first|last|nonfirst|nonlast> (
157157
* nonfirst: append all matching lines to first line and start over with the next non-matching line
158158

159159
##### Important!
160-
If you use multiline logging with raw, it's recommended to json encode the Data to avoid linebreaks in the output, eg:
160+
If you use multiline logging with raw, it's recommended to json encode the Data to avoid line breaks in the output, eg:
161161

162162
"RAW_FORMAT={{ toJSON .Data }}\n"
163163

@@ -167,8 +167,9 @@ If you use multiline logging with raw, it's recommended to json encode the Data
167167
* `BACKLOG` - suppress container tail backlog
168168
* `TAIL` - specify the number of lines in the log tail to capture when logspout starts (default `all`)
169169
* `DEBUG` - emit debug logs
170-
* `EXCLUDE_LABEL` - exclude logs with a given label
170+
* `EXCLUDE_LABEL` - exclude containers with a given label. The label can have a value of true or a custom value matched with : after the label name like label_name:label_value.
171171
* `INACTIVITY_TIMEOUT` - detect hang in Docker API (default 0)
172+
* `HTTP_BIND_ADDRESS` - configure which interface address to listen on (default 0.0.0.0)
172173
* `PORT` or `HTTP_PORT` - configure which port to listen on (default 80)
173174
* `RAW_FORMAT` - log format for the raw adapter (default `{{.Data}}\n`)
174175
* `RETRY_COUNT` - how many times to retry a broken socket (default 10)
@@ -238,34 +239,75 @@ networks:
238239
logging:
239240
services:
240241
logspout:
241-
image: gliderlabs/logspout:latest
242-
networks:
243-
- logging
244-
volumes:
245-
- /etc/hostname:/etc/host_hostname:ro
246-
- /var/run/docker.sock:/var/run/docker.sock
247-
command:
248-
syslog://svt2-logger.am2.cloudra.local:514
249-
deploy:
250-
mode: global
251-
resources:
252-
limits:
253-
cpus: '0.20'
254-
memory: 256M
255-
reservations:
256-
cpus: '0.10'
257-
memory: 128M
242+
image: gliderlabs/logspout:latest
243+
networks:
244+
- logging
245+
volumes:
246+
- /etc/hostname:/etc/host_hostname:ro
247+
- /var/run/docker.sock:/var/run/docker.sock
248+
command:
249+
syslog://svt2-logger.am2.cloudra.local:514
250+
deploy:
251+
mode: global
252+
resources:
253+
limits:
254+
cpus: '0.20'
255+
memory: 256M
256+
reservations:
257+
cpus: '0.10'
258+
memory: 128M
258259
```
259260

260-
logspout can then be deployed as a global service in the swam with the following command
261+
logspout can then be deployed as a global service in the swarm with the following command
261262

262263
```bash
263-
docker stack deploy --compose-file <name of your compose file>
264+
docker stack deploy --compose-file <name of your compose file> STACK
264265
```
265266

266267
More information about services and their mode of deployment can be found here:
267268
https://docs.docker.com/engine/swarm/how-swarm-mode-works/services/
268269

270+
### TLS Settings
271+
logspout supports modification of the client TLS settings via environment variables described below:
272+
273+
| Environment Variable | Description |
274+
| :--- | :--- |
275+
| `LOGSPOUT_TLS_DISABLE_SYSTEM_ROOTS` | when set to `true` it disables loading the system trust store into the trust store of logspout |
276+
| `LOGSPOUT_TLS_CA_CERTS` | a comma seperated list of filesystem paths to pem encoded CA certificates that should be added to logsput's TLS trust store. Each pem file can contain more than one certificate |
277+
| `LOGSPOUT_TLS_CLIENT_CERT` | filesytem path to pem encoded x509 client certificate to load when TLS mutual authentication is desired |
278+
| `LOGSPOUT_TLS_CLIENT_KEY` | filesytem path to pem encoded client private key to load when TLS mutual authentication is desired |
279+
| `LOGSPOUT_TLS_HARDENING` | when set to `true` it enables stricter client TLS settings designed to mitigate some known TLS vulnerabilities |
280+
281+
#### Example TLS settings
282+
The following settings cover some common use cases.
283+
When running docker, use the `-e` flag to supply environment variables
284+
285+
**add your own CAs to the list of trusted authorities**
286+
```
287+
export LOGSPOUT_TLS_CA_CERTS="/opt/tls/ca/myRootCA1.pem,/opt/tls/ca/myRootCA2.pem"
288+
```
289+
290+
**force logspout to ONLY trust your own CA**
291+
```
292+
export LOGSPOUT_TLS_DISABLE_SYSTEM_ROOTS=true
293+
export LOGSPOUT_TLS_CA_CERTS="/opt/tls/ca/myRootCA1.pem"
294+
```
295+
296+
**configure client authentication**
297+
```
298+
export LOGSPOUT_TLS_CLIENT_CERT="/opt/tls/client/myClient.pem"
299+
export LOGSPOUT_TLS_CLIENT_KEY="/opt/tls/client/myClient-key.pem"
300+
```
301+
302+
**highest possible security settings (paranoid mode)**
303+
```
304+
export LOGSPOUT_TLS_DISABLE_SYSTEM_ROOTS=true
305+
export LOGSPOUT_TLS_HARDENING=true
306+
export LOGSPOUT_TLS_CA_CERTS="/opt/tls/ca/myRootCA1.pem"
307+
export LOGSPOUT_TLS_CLIENT_CERT="/opt/tls/client/myClient.pem"
308+
export LOGSPOUT_TLS_CLIENT_KEY="/opt/tls/client/myClient-key.pem"
309+
```
310+
269311
## Modules
270312

271313
The standard distribution of logspout comes with all modules defined in this repository. You can remove or add new modules with custom builds of logspout. In the `custom` dir, edit the `modules.go` file and do a `docker build`.
@@ -282,7 +324,7 @@ The standard distribution of logspout comes with all modules defined in this rep
282324

283325
### Third-party modules
284326

285-
* [logspout-kafka](https://github.com/gettyimages/logspout-kafka)
327+
* [logspout-kafka](https://github.com/dylanmei/logspout-kafka)
286328
* logspout-redis...
287329
* [logspout-logstash](https://github.com/looplab/logspout-logstash)
288330
* [logspout-redis-logstash](https://github.com/rtoma/logspout-redis-logstash)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.2.5
1+
v3.2.6

circle.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
make -e test
2424
- run: |
2525
make -e test-tls
26+
- run: |
27+
make -e test-healthcheck
2628
- run: |
2729
make -e test-custom
2830
- run: |

healthcheck/healthcheck.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package healthcheck
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/gliderlabs/logspout/router"
7+
"github.com/gorilla/mux"
8+
)
9+
10+
func init() {
11+
router.HttpHandlers.Register(HealthCheck, "health")
12+
}
13+
14+
// HealthCheck returns a http.Handler for the health check
15+
func HealthCheck() http.Handler {
16+
r := mux.NewRouter()
17+
r.HandleFunc("/health", func(w http.ResponseWriter, req *http.Request) {
18+
w.Write([]byte("Healthy!\n"))
19+
})
20+
return r
21+
}

modules.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
_ "github.com/gliderlabs/logspout/healthcheck"
45
_ "github.com/gliderlabs/logspout/adapters/raw"
56
_ "github.com/gliderlabs/logspout/adapters/syslog"
67
_ "github.com/gliderlabs/logspout/adapters/multiline"

router/http.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import (
77
)
88

99
func init() {
10+
bindAddress := getopt("HTTP_BIND_ADDRESS", "0.0.0.0")
1011
port := getopt("PORT", getopt("HTTP_PORT", "80"))
11-
Jobs.Register(&httpService{port}, "http")
12+
Jobs.Register(&httpService{bindAddress, port}, "http")
1213
}
1314

1415
type httpService struct {
15-
port string
16+
bindAddress string
17+
port string
1618
}
1719

1820
func (s *httpService) Name() string {
@@ -30,5 +32,5 @@ func (s *httpService) Setup() error {
3032
}
3133

3234
func (s *httpService) Run() error {
33-
return http.ListenAndServe(":"+s.port, nil)
35+
return http.ListenAndServe(s.bindAddress+":"+s.port, nil)
3436
}

0 commit comments

Comments
 (0)