Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

feat: allow administrator to disable logging of ping requests

Johan Fleury12c1e38df2fd
diff --git a/config/default.yaml b/config/default.yaml
index d2c713b526..cbe6fa9ead 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -100,6 +100,7 @@ log:
maxFileSize: 12MB
maxFiles: 20
anonymizeIP: false
+ log_ping_requests: true
trending:
videos:
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 4506ce2596..8a3f26a1cf 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -100,6 +100,7 @@ log:
maxFileSize: 12MB
maxFiles: 20
anonymizeIP: false
+ log_ping_requests: true
trending:
videos:
diff --git a/server.ts b/server.ts
index e674a09d4a..f844c9564b 100644
--- a/server.ts
+++ b/server.ts
@@ -158,7 +158,10 @@ morgan.token('user-agent', (req: express.Request) => {
return req.get('user-agent')
})
app.use(morgan('combined', {
- stream: { write: logger.info.bind(logger) }
+ stream: { write: logger.info.bind(logger) },
+ skip: function (req, res) {
+ return (req.path === '/api/v1/ping' && CONFIG.LOG.LOG_PING_REQUESTS === false)
+ },
}))
// For body requests
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index 0f58dc1d4c..1630f7f0c8 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -104,7 +104,8 @@ const CONFIG = {
MAX_FILE_SIZE: bytes.parse(config.get<string>('log.rotation.maxFileSize')),
MAX_FILES: config.get<number>('log.rotation.maxFiles')
},
- ANONYMIZE_IP: config.get<boolean>('log.anonymizeIP')
+ ANONYMIZE_IP: config.get<boolean>('log.anonymizeIP'),
+ LOG_PING_REQUESTS: config.get<boolean>('log.log_ping_requests')
},
TRENDING: {
VIDEOS: {
diff --git a/support/docker/production/config/custom-environment-variables.yaml b/support/docker/production/config/custom-environment-variables.yaml
index 954c3714b6..63459d8a04 100644
--- a/support/docker/production/config/custom-environment-variables.yaml
+++ b/support/docker/production/config/custom-environment-variables.yaml
@@ -42,6 +42,11 @@ smtp:
__format: "json"
from_address: "PEERTUBE_SMTP_FROM"
+log:
+ log_ping_requests:
+ __name: "PEERTUBE_LOG_PING_REQUESTS"
+ __format: "json"
+
user:
video_quota:
__name: "PEERTUBE_USER_VIDEO_QUOTA"