|
|
@ -61,9 +61,10 @@ 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);
|
|
|
|
proc.stdout
|
|
|
|
proc.stdout
|
|
|
|
.setEncoding("utf8")
|
|
|
|
.setEncoding("utf8")
|
|
|
|
.pipe(new RegexBlockStream(/^\d{2}:\d{2}:\d{2}.\d{6}.*(\n( {4,8}|\t\t?).*)+\n/gm))
|
|
|
|
.pipe(regexBlockStream)
|
|
|
|
.pipe(new PacketStreamFactory())
|
|
|
|
.pipe(new PacketStreamFactory())
|
|
|
|
.pipe(new PacketInfluxPointFactory())
|
|
|
|
.pipe(new PacketInfluxPointFactory())
|
|
|
|
.pipe(new InfluxPointWriter(influxDb, env.INFLUX_ORG, env.INFLUX_BUCKET));
|
|
|
|
.pipe(new InfluxPointWriter(influxDb, env.INFLUX_ORG, env.INFLUX_BUCKET));
|
|
|
@ -75,6 +76,10 @@ if(errorMsg){
|
|
|
|
loggerTcpdump.error(data);
|
|
|
|
loggerTcpdump.error(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regexBlockStream.on('error', (err) => {
|
|
|
|
|
|
|
|
if(err) loggerTcpdump.error(err);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
proc.on("error", (err) => {
|
|
|
|
proc.on("error", (err) => {
|
|
|
|
loggerTcpdump.error(err);
|
|
|
|
loggerTcpdump.error(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|