This commit is contained in:
Aleksandr Statciuk 2022-01-11 00:25:02 +03:00
parent 0a33284308
commit af41021b99
2 changed files with 2 additions and 2 deletions

View file

@ -0,0 +1,22 @@
const { db, logger, file, parser } = require('../core')
const _ = require('lodash')
const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs'
async function main() {
await db.programs.reset()
const files = await file.list(`${LOGS_DIR}/load-cluster/cluster_*.log`)
for (const filepath of files) {
const results = await parser.parseLogs(filepath)
results.forEach(result => {
const programs = result.programs.map(p => {
p.site = result.site
return p
})
db.programs.insert(programs)
})
}
db.programs.compact()
}
main()