From 566c125d6eee3bd907404523d94e1e0b5e403a46 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 11 Dec 2019 14:14:01 +0100 Subject: Serve audit logs to client --- server/helpers/audit-logger.ts | 3 ++- server/helpers/logger.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'server/helpers') diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index f536da439..9b258dc3a 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts @@ -9,6 +9,7 @@ import { User, VideoAbuse, VideoChannel, VideoDetails, VideoImport } from '../.. import { VideoComment } from '../../shared/models/videos/video-comment.model' import { CustomConfig } from '../../shared/models/server/custom-config.model' import { CONFIG } from '../initializers/config' +import { AUDIT_LOG_FILENAME } from '@server/initializers/constants' function getAuditIdFromRes (res: express.Response) { return res.locals.oauth.token.User.username @@ -29,7 +30,7 @@ const auditLogger = winston.createLogger({ levels: { audit: 0 }, transports: [ new winston.transports.File({ - filename: path.join(CONFIG.STORAGE.LOG_DIR, 'peertube-audit.log'), + filename: path.join(CONFIG.STORAGE.LOG_DIR, AUDIT_LOG_FILENAME), level: 'audit', maxsize: 5242880, maxFiles: 5, diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index d21746963..c2ff2bae6 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts @@ -5,6 +5,7 @@ import * as winston from 'winston' import { FileTransportOptions } from 'winston/lib/winston/transports' import { CONFIG } from '../initializers/config' import { omit } from 'lodash' +import { LOG_FILENAME } from '@server/initializers/constants' const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT @@ -58,7 +59,7 @@ const labelFormatter = winston.format.label({ }) const fileLoggerOptions: FileTransportOptions = { - filename: path.join(CONFIG.STORAGE.LOG_DIR, 'peertube.log'), + filename: path.join(CONFIG.STORAGE.LOG_DIR, LOG_FILENAME), handleExceptions: true, format: winston.format.combine( winston.format.timestamp(), -- cgit v1.2.3