diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94da0c4b..293eea3f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ This document outlines major changes between releases.
## [Unreleased]
### Added
+- `logger.sampling.enabled` config option (#1179)
### Changed
diff --git a/cmd/s3-gw/app_settings.go b/cmd/s3-gw/app_settings.go
index 85fe8f0c..6debbbb9 100644
--- a/cmd/s3-gw/app_settings.go
+++ b/cmd/s3-gw/app_settings.go
@@ -35,9 +35,10 @@ const (
const ( // Settings.
// Logger.
- cfgLoggerLevel = "logger.level"
- cfgLoggerEncoding = "logger.encoding"
- cfgLoggerTimestamp = "logger.timestamp"
+ cfgLoggerLevel = "logger.level"
+ cfgLoggerEncoding = "logger.encoding"
+ cfgLoggerTimestamp = "logger.timestamp"
+ cfgLoggerSamplingOn = "logger.sampling.enabled"
// Wallet.
cfgWalletPath = "wallet.path"
@@ -413,7 +414,9 @@ func newLogger(v *viper.Viper) *Logger {
c := zap.NewProductionConfig()
c.Level = zap.NewAtomicLevelAt(lvl)
c.Encoding = encoding
- c.Sampling = nil
+ if !v.GetBool(cfgLoggerSamplingOn) {
+ c.Sampling = nil
+ }
if (term.IsTerminal(int(os.Stdout.Fd())) && !v.GetBool(cfgLoggerTimestamp)) || v.GetBool(cfgLoggerTimestamp) {
c.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
} else {
diff --git a/config/config.env b/config/config.env
index a0ddba47..3ebc504d 100644
--- a/config/config.env
+++ b/config/config.env
@@ -49,6 +49,7 @@ S3_GW_CONFIG=/path/to/config/yaml
S3_GW_LOGGER_LEVEL=debug
S3_GW_LOGGER_ENCODING=console
S3_GW_LOGGER_TIMESTAMP=false
+S3_GW_LOGGER_SAMPLING_ENABLED=true
# RPC endpoint and order of resolving of bucket names
S3_GW_RPC_ENDPOINT=http://morph-chain.neofs.devenv:30333/
diff --git a/config/config.yaml b/config/config.yaml
index a536433d..0f86c2c1 100644
--- a/config/config.yaml
+++ b/config/config.yaml
@@ -42,6 +42,8 @@ logger:
level: debug
encoding: console
timestamp: false
+ sampling:
+ enabled: true
# RPC endpoint and order of resolving of bucket names
fschain:
diff --git a/docs/configuration.md b/docs/configuration.md
index f947baae..bec53f37 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -315,6 +315,8 @@ logger:
level: debug
encoding: console
timestamp: true
+ sampling:
+ enabled: true
```
| Parameter | Type | SIGHUP reload | Default value | Description |
@@ -322,6 +324,7 @@ logger:
| `level` | `string` | yes | `debug` | Logging level.
Possible values: `debug`, `info`, `warn`, `error`, `dpanic`, `panic`, `fatal`. |
| `encoding` | `string` | | `console` | Encoding type.
Possible values: `console`, `json`. |
| `timestamp` | `bool` | | `false` | Flag to enable timestamps. If the parameter is not set, they will be enabled when you run with tty. |
+| `sampling.enabled` | `bool` | | `false` | Flag to enable log sampling. |
### `cache` section