Moved Stream-creations outside

f_userHelper
Ruakij 3 years ago
parent 4ddbe3f06f
commit c28bbaaada

@ -62,12 +62,15 @@ if(errorMsg){
let proc = exec(cmd); let proc = exec(cmd);
logger.debug("Creating & Attaching streams.."); logger.debug("Creating & Attaching streams..");
let regexBlockStream = new RegexBlockStream(/^\d{2}:\d{2}:\d{2}.\d{6}.*(\n( {4,8}|\t\t?).*)+\n/gm); let regexBlockStream = new RegexBlockStream(/^\d{2}:\d{2}:\d{2}.\d{6}.*(\n( {4,8}|\t\t?).*)+\n/gm);
let packetStreamFactory = new PacketStreamFactory();
let packetInfluxPointFactory = new PacketInfluxPointFactory();
let influxPointWriter = new InfluxPointWriter(influxDb, env.INFLUX_ORG, env.INFLUX_BUCKET);
proc.stdout proc.stdout
.setEncoding("utf8") .setEncoding("utf8")
.pipe(regexBlockStream) .pipe(regexBlockStream)
.pipe(new PacketStreamFactory()) .pipe(packetStreamFactory)
.pipe(new PacketInfluxPointFactory()) .pipe(packetInfluxPointFactory)
.pipe(new InfluxPointWriter(influxDb, env.INFLUX_ORG, env.INFLUX_BUCKET)); .pipe(influxPointWriter);
logger.debug("Attaching error-logger.."); logger.debug("Attaching error-logger..");
const loggerTcpdump = logFactory("tcpdump"); const loggerTcpdump = logFactory("tcpdump");

Loading…
Cancel
Save