Add max file size, max files and ip anonymize log options
This commit is contained in:
parent
22a73cb879
commit
2f6b5e2d6e
5 changed files with 16 additions and 5 deletions
|
@ -86,6 +86,9 @@ log:
|
|||
level: 'info' # debug/info/warning/error
|
||||
rotation:
|
||||
enabled : true
|
||||
maxFileSize: 12MB
|
||||
maxFiles: 20
|
||||
anonymizeIP: false
|
||||
|
||||
search:
|
||||
# Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance
|
||||
|
|
|
@ -87,6 +87,9 @@ log:
|
|||
level: 'info' # debug/info/warning/error
|
||||
rotation:
|
||||
enabled : true # Enabled by default, if disabled make sure that 'storage.logs' is pointing to a folder handled by logrotate
|
||||
maxFileSize: 12MB
|
||||
maxFiles: 20
|
||||
anonymizeIP: false
|
||||
|
||||
search:
|
||||
# Add ability to fetch remote videos/actors by their URI, that may not be federated with your instance
|
||||
|
|
|
@ -142,7 +142,7 @@ if (isTestInstance()) {
|
|||
|
||||
// For the logger
|
||||
morgan.token('remote-addr', req => {
|
||||
if (req.get('DNT') === '1') {
|
||||
if (CONFIG.LOG.ANONYMIZE_IP === true || req.get('DNT') === '1') {
|
||||
return anonymize(req.ip, 16, 16)
|
||||
}
|
||||
|
||||
|
|
|
@ -67,9 +67,9 @@ const fileLoggerOptions: FileTransportOptions = {
|
|||
)
|
||||
}
|
||||
|
||||
if (CONFIG.LOG.ROTATION) {
|
||||
fileLoggerOptions.maxsize = 1024 * 1024 * 12
|
||||
fileLoggerOptions.maxFiles = 20
|
||||
if (CONFIG.LOG.ROTATION.ENABLED) {
|
||||
fileLoggerOptions.maxsize = CONFIG.LOG.ROTATION.MAX_FILE_SIZE
|
||||
fileLoggerOptions.maxFiles = CONFIG.LOG.ROTATION.MAX_FILES
|
||||
}
|
||||
|
||||
const logger = winston.createLogger({
|
||||
|
|
|
@ -93,7 +93,12 @@ const CONFIG = {
|
|||
TRUST_PROXY: config.get<string[]>('trust_proxy'),
|
||||
LOG: {
|
||||
LEVEL: config.get<string>('log.level'),
|
||||
ROTATION: config.get<boolean>('log.rotation.enabled')
|
||||
ROTATION: {
|
||||
ENABLED: config.get<boolean>('log.rotation.enabled'),
|
||||
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')
|
||||
},
|
||||
SEARCH: {
|
||||
REMOTE_URI: {
|
||||
|
|
Loading…
Reference in a new issue