Skip to content

Commit 63d14b3

Browse files
fix: added an option to turn on http access logs
1 parent 8647414 commit 63d14b3

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

chart/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ configuration:
2222
# How often the pod queries prometheus for metrics
2323
refresh: 30s
2424

25+
# Whether to print http logs to stdout
26+
http_logs: true
27+
2528
# Whether to expose prompage metrics
2629
metrics:
2730
enabled: false

internal/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type Datasource struct {
5757

5858
type Config struct {
5959
Port int `yaml:"port"`
60+
HttpLogs *bool `yaml:"http_logs"`
6061
Metrics Metrics `yaml:"metrics"`
6162
Services []Service `yaml:"services"`
6263

@@ -100,6 +101,10 @@ func setDefaults(conf *Config) {
100101
if conf.Metrics.Port == 0 {
101102
conf.Metrics.Port = 9743
102103
}
104+
if conf.HttpLogs == nil {
105+
en := true
106+
conf.HttpLogs = &en
107+
}
103108

104109
if conf.Prometheus != "" {
105110
conf.Datasources = append(conf.Datasources, Datasource{

internal/http/http.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ func NewHttp(app *app.App, cache *ResultCache) *Http {
2727
e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{
2828
Timeout: time.Second * 5,
2929
}))
30+
if *app.Config.HttpLogs {
31+
e.Use(middleware.Logger())
32+
}
3033

3134
e.GET("/", NewStatusPageHandler(app, cache))
3235
e.GET("/:name", NewGetServiceHandler(app, cache))

0 commit comments

Comments
 (0)