Fix logs regex
authorChocobozzz <me@florianbigard.com>
Thu, 12 Dec 2019 08:15:38 +0000 (09:15 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 12 Dec 2019 08:43:59 +0000 (09:43 +0100)
server/controllers/api/server/logs.ts

index a0ca21cd556d9f1671e37232ca87851b33706402..cd1e0f5bf0eb7ca51560697ffec30310bae6d893 100644 (file)
@@ -79,6 +79,7 @@ async function generateOutput (options: {
     if (nameFilter.exec(meta.file) === null) continue
 
     const path = join(CONFIG.STORAGE.LOG_DIR, meta.file)
+    logger.debug('Opening %s to fetch logs.', path)
 
     const result = await getOutputFromFile(path, startDate, endDate, level, currentSize)
     if (!result.output) break
@@ -136,5 +137,5 @@ async function getOutputFromFile (path: string, startDate: Date, endDate: Date,
 }
 
 function generateLogNameFilter (baseName: string) {
-  return new RegExp('^' + baseName.replace(/\.log$/, '') + '\d*.log$')
+  return new RegExp('^' + baseName.replace(/\.log$/, '') + '\\d*.log$')
 }