๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const logger = require('./logger');//JUST PICKUP A LOGGER LIKE THIS LOGGER HERE: https://gist.github.com/emg110/1ab0584ff59b6f216304ec68b0977f7c | |
| const { Client } = require('@elastic/elasticsearch'); | |
| const client = new Client({ node: 'http://YOUR_ES_SERVER:ES_HTTP/S_PORT' }); | |
| const inStream = fs.createReadStream('././data/YOUR_NEDB_FILE.db'); | |
| var lineReader = require('readline').createInterface({ | |
| input: inStream | |
| }); | |
| async function writeToES(doc){ | |
| await client.index({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { createLogger, format, transports } = require('winston'); | |
| const chalk = require('chalk'); | |
| const { combine, timestamp, label, printf, simple, splat } = format; | |
| const consoleFormat = printf(({ level, message, label, timestamp }) => { | |
| var levelUpper = level.toUpperCase(); | |
| switch (levelUpper) { | |
| case "INFO": | |
| message = chalk.green(message); | |
| level = chalk.black.bgGreenBright.bold(level); | |
| break; |