[#369] Change MaxBody to be counting in megabytes
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
parent
2bfeeca024
commit
9ba6599c47
3 changed files with 3 additions and 3 deletions
|
@ -122,7 +122,7 @@ func LogHTTP(l *zap.Logger, config *LogHTTPConfig) Func {
|
|||
|
||||
httplog = withFieldIfExist(httplog, "query", r.URL.Query())
|
||||
httplog = withFieldIfExist(httplog, "headers", r.Header)
|
||||
if r.ContentLength > 0 && r.ContentLength <= config.MaxBody {
|
||||
if r.ContentLength > 0 && r.ContentLength <= config.MaxBody<<20 {
|
||||
httplog, err = withBody(httplog, r)
|
||||
if err != nil {
|
||||
l.Warn(logs.FailedToGetRequestBody, zap.Error(err))
|
||||
|
|
|
@ -724,7 +724,7 @@ func newSettings() *viper.Viper {
|
|||
|
||||
// http logger
|
||||
v.SetDefault(cfgHTTPLoggingEnabled, false)
|
||||
v.SetDefault(cfgHTTPLoggingMaxBody, 1024)
|
||||
v.SetDefault(cfgHTTPLoggingMaxBody, 10)
|
||||
v.SetDefault(cfgHTTPLoggingMaxLogSize, 50)
|
||||
v.SetDefault(cfgHTTPLoggingDestination, "stdout")
|
||||
v.SetDefault(cfgHTTPLoggingGzip, false)
|
||||
|
|
|
@ -389,7 +389,7 @@ http_logging:
|
|||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
||||
|----------------|--------|---------------|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `enabled` | bool | yes | false | Flag to enable the logger. |
|
||||
| `max_body` | int | yes | 1024 | Max body size for log output in bytes. |
|
||||
| `max_body` | int | yes | 10 | Max size for request and response bodies that will be attached to the log (in megabytes). |
|
||||
| `max_log_size` | int | yes | 50 | Log file size threshold (in megabytes) to be moved in backup file. After reaching threshold, initial filename is appended with timestamp. And new empty file with initial name is created. |
|
||||
| `gzip` | bool | yes | false | Whether to enable Gzip compression for backup log files. |
|
||||
| `destination` | string | yes | stdout | Specify path for log output. Accepts log file path, or "stdout" and "stderr" reserved words to print in output streams. |
|
||||
|
|
Loading…
Reference in a new issue