appleboy / appleboy/gorush

Several issues with access log configuration

Open
#538 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
8.8k
Forks
887
PR merge metrics
No merged PRs in 30d

Description

* Setting `access_level: "error"` disables server status messages, this should be a different logger.
For example these messages which are logged during startup:
```
{"level":"info","msg":"Init App Status Engine as memory","time":"2020-09-02T15:59:14Z"}
{"level":"info","msg":"worker number is 4, queue number is 8192","time":"2020-09-02T15:59:14Z"}
{"level":"info","msg":"gRPC server is disabled.","time":"2020-09-02T15:59:14Z"}
{"level":"info","msg":"HTTPD server is running on 8088 port.","time":"2020-09-02T15:59:14Z"}
```

* Setting `access_level: "error"` has no effect on HTTP access logging:
```
{"level":"info","status":200,"method":"GET","path":"/api/stat/go","ip":"172.17.0.1","latency":0.328,"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36","time":"2020-09-02T15:58:28Z","message":"Request"}
```

* Setting `format: "text"` has no effect, log messages are still logged as JSON.

* Setting `access_log` to a file only affects server log but not HTTP request log.

---

I propose to have two loggers:
* access_log
* server_log (with config alias error_log for backwards compatibility)

`server_log` should have all internal log messages written by gorush (startup, shutdown, error, push messages).
`access_log` should only have access log to the external API.

Contributor guide

No contributing guide indexed for this repository

Research direction

Trace the configuration handling for access_level, format, and access_log, then follow the server and HTTP request logging paths described in the issue. Confirm how startup and request messages are currently routed; done means separate server and access log behavior, working text and file settings, and backwards compatibility for error_log.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.