Skip to content

Commit

Permalink
Uses debug log for http: TLS handshake error ... EOF (#1904)
Browse files Browse the repository at this point in the history
See
* golang/go#26918
* kubernetes/kubernetes#91277

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Nov 20, 2021
1 parent 1b5dd5e commit 1e26fcd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions skipper.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
ot "github.com/opentracing/opentracing-go"
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
stdlog "log"

"github.com/zalando/skipper/circuit"
"github.com/zalando/skipper/dataclients/kubernetes"
Expand Down Expand Up @@ -786,6 +787,23 @@ type Options struct {
testOptions
}

type serverErrorLogWriter struct{}

func (*serverErrorLogWriter) Write(p []byte) (int, error) {
m := string(p)
// https://github.com/golang/go/issues/26918
if strings.HasPrefix(m, "http: TLS handshake error") && strings.HasSuffix(m, ": EOF\n") {
log.Debug(m)
} else {
log.Error(m)
}
return len(p), nil
}

func newServerErrorLog() *stdlog.Logger {
return stdlog.New(&serverErrorLogWriter{}, "", 0)
}

func createDataClients(o Options, auth innkeeper.Authentication) ([]routing.DataClient, error) {
var clients []routing.DataClient

Expand Down Expand Up @@ -1050,6 +1068,7 @@ func listenAndServeQuit(
WriteTimeout: o.WriteTimeoutServer,
IdleTimeout: o.IdleTimeoutServer,
MaxHeaderBytes: o.MaxHeaderBytes,
ErrorLog: newServerErrorLog(),
}

if o.EnableConnMetricsServer {
Expand Down

0 comments on commit 1e26fcd

Please sign in to comment.