X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f0e6212bbe6e34f6ac4e928a236e77cca852895d..5bc52dbe43040297c622900797c55e686b377e9b:/services/health/main.go diff --git a/services/health/main.go b/services/health/main.go index 3e089fa5a2..b6358deefc 100644 --- a/services/health/main.go +++ b/services/health/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "net/http" "git.curoverse.com/arvados.git/sdk/go/arvados" @@ -10,10 +11,13 @@ import ( ) func main() { + configFile := flag.String("config", arvados.DefaultConfigFile, "`path` to arvados configuration file") + flag.Parse() + log.SetFormatter(&log.JSONFormatter{ TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00", }) - cfg, err := arvados.GetConfig() + cfg, err := arvados.GetConfig(*configFile) if err != nil { log.Fatal(err) } @@ -26,11 +30,18 @@ func main() { log.Fatal(err) } + log := log.WithField("Service", "Health") srv := &httpserver.Server{ Addr: nodeCfg.Health.Listen, Server: http.Server{ Handler: &health.Aggregator{ Config: cfg, + Log: func(req *http.Request, err error) { + log.WithField("RemoteAddr", req.RemoteAddr). + WithField("Path", req.URL.Path). + WithError(err). + Info("HTTP request") + }, }, }, }