Added error-handling for regexBlockStream
This commit is contained in:
parent
5a0118aedd
commit
1bf761970f
@ -61,9 +61,10 @@ if(errorMsg){
|
||||
|
||||
let proc = exec(cmd);
|
||||
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
|
||||
.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 PacketInfluxPointFactory())
|
||||
.pipe(new InfluxPointWriter(influxDb, env.INFLUX_ORG, env.INFLUX_BUCKET));
|
||||
@ -75,6 +76,10 @@ if(errorMsg){
|
||||
loggerTcpdump.error(data);
|
||||
});
|
||||
|
||||
regexBlockStream.on('error', (err) => {
|
||||
if(err) loggerTcpdump.error(err);
|
||||
})
|
||||
|
||||
proc.on("error", (err) => {
|
||||
loggerTcpdump.error(err);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user