diff --git a/config/default.yaml b/config/default.yaml index d2c713b52..cbe6fa9ea 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 4506ce259..8a3f26a1c 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 e674a09d4..f844c9564 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 0f58dc1d4..1630f7f0c 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -104,7 +104,8 @@ const CONFIG = { MAX_FILE_SIZE: bytes.parse(config.get('log.rotation.maxFileSize')), MAX_FILES: config.get('log.rotation.maxFiles') }, - ANONYMIZE_IP: config.get('log.anonymizeIP') + ANONYMIZE_IP: config.get('log.anonymizeIP'), + LOG_PING_REQUESTS: config.get('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 954c3714b..63459d8a0 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"