aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/default.yaml3
-rw-r--r--config/production.yaml.example3
-rw-r--r--server.ts2
-rw-r--r--server/helpers/logger.ts6
-rw-r--r--server/initializers/config.ts7
5 files changed, 16 insertions, 5 deletions
diff --git a/config/default.yaml b/config/default.yaml
index 7c718e174..7fe817aa0 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -86,6 +86,9 @@ log:
86 level: 'info' # debug/info/warning/error 86 level: 'info' # debug/info/warning/error
87 rotation: 87 rotation:
88 enabled : true 88 enabled : true
89 maxFileSize: 12MB
90 maxFiles: 20
91 anonymizeIP: false
89 92
90search: 93search:
91 # Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance 94 # Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance
diff --git a/config/production.yaml.example b/config/production.yaml.example
index 98b1669cd..629d0c4b6 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -87,6 +87,9 @@ log:
87 level: 'info' # debug/info/warning/error 87 level: 'info' # debug/info/warning/error
88 rotation: 88 rotation:
89 enabled : true # Enabled by default, if disabled make sure that 'storage.logs' is pointing to a folder handled by logrotate 89 enabled : true # Enabled by default, if disabled make sure that 'storage.logs' is pointing to a folder handled by logrotate
90 maxFileSize: 12MB
91 maxFiles: 20
92 anonymizeIP: false
90 93
91search: 94search:
92 # Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance 95 # Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance
diff --git a/server.ts b/server.ts
index b2541eed6..8df3add2c 100644
--- a/server.ts
+++ b/server.ts
@@ -142,7 +142,7 @@ if (isTestInstance()) {
142 142
143// For the logger 143// For the logger
144morgan.token('remote-addr', req => { 144morgan.token('remote-addr', req => {
145 if (req.get('DNT') === '1') { 145 if (CONFIG.LOG.ANONYMIZE_IP === true || req.get('DNT') === '1') {
146 return anonymize(req.ip, 16, 16) 146 return anonymize(req.ip, 16, 16)
147 } 147 }
148 148
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts
index c2ff2bae6..395417612 100644
--- a/server/helpers/logger.ts
+++ b/server/helpers/logger.ts
@@ -67,9 +67,9 @@ const fileLoggerOptions: FileTransportOptions = {
67 ) 67 )
68} 68}
69 69
70if (CONFIG.LOG.ROTATION) { 70if (CONFIG.LOG.ROTATION.ENABLED) {
71 fileLoggerOptions.maxsize = 1024 * 1024 * 12 71 fileLoggerOptions.maxsize = CONFIG.LOG.ROTATION.MAX_FILE_SIZE
72 fileLoggerOptions.maxFiles = 20 72 fileLoggerOptions.maxFiles = CONFIG.LOG.ROTATION.MAX_FILES
73} 73}
74 74
75const logger = winston.createLogger({ 75const logger = winston.createLogger({
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index c6e478f57..95b069533 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -93,7 +93,12 @@ const CONFIG = {
93 TRUST_PROXY: config.get<string[]>('trust_proxy'), 93 TRUST_PROXY: config.get<string[]>('trust_proxy'),
94 LOG: { 94 LOG: {
95 LEVEL: config.get<string>('log.level'), 95 LEVEL: config.get<string>('log.level'),
96 ROTATION: config.get<boolean>('log.rotation.enabled') 96 ROTATION: {
97 ENABLED: config.get<boolean>('log.rotation.enabled'),
98 MAX_FILE_SIZE: bytes.parse(config.get<string>('log.rotation.maxFileSize')),
99 MAX_FILES: config.get<number>('log.rotation.maxFiles')
100 },
101 ANONYMIZE_IP: config.get<boolean>('log.anonymizeIP')
97 }, 102 },
98 SEARCH: { 103 SEARCH: {
99 REMOTE_URI: { 104 REMOTE_URI: {