aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-11 14:14:01 +0100
committerChocobozzz <me@florianbigard.com>2019-12-11 14:14:01 +0100
commit566c125d6eee3bd907404523d94e1e0b5e403a46 (patch)
treec477cdd2ba745015d80052968c37927b1bca1254 /server/helpers
parent92e0f42e8ce5f1ab5e4023900b8194627231a11b (diff)
downloadPeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.tar.gz
PeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.tar.zst
PeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.zip
Serve audit logs to client
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/audit-logger.ts3
-rw-r--r--server/helpers/logger.ts3
2 files changed, 4 insertions, 2 deletions
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 '../..
9import { VideoComment } from '../../shared/models/videos/video-comment.model' 9import { VideoComment } from '../../shared/models/videos/video-comment.model'
10import { CustomConfig } from '../../shared/models/server/custom-config.model' 10import { CustomConfig } from '../../shared/models/server/custom-config.model'
11import { CONFIG } from '../initializers/config' 11import { CONFIG } from '../initializers/config'
12import { AUDIT_LOG_FILENAME } from '@server/initializers/constants'
12 13
13function getAuditIdFromRes (res: express.Response) { 14function getAuditIdFromRes (res: express.Response) {
14 return res.locals.oauth.token.User.username 15 return res.locals.oauth.token.User.username
@@ -29,7 +30,7 @@ const auditLogger = winston.createLogger({
29 levels: { audit: 0 }, 30 levels: { audit: 0 },
30 transports: [ 31 transports: [
31 new winston.transports.File({ 32 new winston.transports.File({
32 filename: path.join(CONFIG.STORAGE.LOG_DIR, 'peertube-audit.log'), 33 filename: path.join(CONFIG.STORAGE.LOG_DIR, AUDIT_LOG_FILENAME),
33 level: 'audit', 34 level: 'audit',
34 maxsize: 5242880, 35 maxsize: 5242880,
35 maxFiles: 5, 36 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'
5import { FileTransportOptions } from 'winston/lib/winston/transports' 5import { FileTransportOptions } from 'winston/lib/winston/transports'
6import { CONFIG } from '../initializers/config' 6import { CONFIG } from '../initializers/config'
7import { omit } from 'lodash' 7import { omit } from 'lodash'
8import { LOG_FILENAME } from '@server/initializers/constants'
8 9
9const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT 10const label = CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.WEBSERVER.PORT
10 11
@@ -58,7 +59,7 @@ const labelFormatter = winston.format.label({
58}) 59})
59 60
60const fileLoggerOptions: FileTransportOptions = { 61const fileLoggerOptions: FileTransportOptions = {
61 filename: path.join(CONFIG.STORAGE.LOG_DIR, 'peertube.log'), 62 filename: path.join(CONFIG.STORAGE.LOG_DIR, LOG_FILENAME),
62 handleExceptions: true, 63 handleExceptions: true,
63 format: winston.format.combine( 64 format: winston.format.combine(
64 winston.format.timestamp(), 65 winston.format.timestamp(),