Logging data editor module reuqests

This commit is contained in:
MrFry
2020-03-25 17:20:07 +01:00
parent 592ecfda79
commit 10ccd876d4
3 changed files with 9 additions and 2 deletions

View File

@@ -72,9 +72,16 @@ app.use(function (req, res, next) {
} }
let ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress let ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
logger.LogReq(req, true, res.statusCode) logger.LogReq(req, true, res.statusCode)
let toLog = loggableKeywords.some((x) => { let toLog = loggableKeywords.some((x) => {
return req.url.includes(x) return req.url.includes(x)
}) })
const hostname = req.hostname.replace('www.', '').split('.')[0]
if (hostname.includes('dataeditor')) {
toLog = true
}
if (toLog) { logger.LogReq(req) } if (toLog) { logger.LogReq(req) }
if (res.statusCode !== 404) { logger.LogStat(req.url, ip) } if (res.statusCode !== 404) { logger.LogStat(req.url, ip) }
}) })