nsyslog
Version:
Modular new generation log agent. Reads, transform, aggregate, correlate and send logs from sources to destinations
30 lines (23 loc) • 7.99 kB
JavaScript
const MSG = `I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option. I have the following snippet calling a perl script which writes to STDERR and STDOUT. I've been following the recomended procedures such as auto flushing the STDOUT and STDERR in the perl script and using streamgobbler threads. I've noticed this to help my issue in to a degree but at times where the perl script generates large volumes of output it will still fill up its pipes and hang. The only thing that seems to stop this adding the following to my perl script however obviously I would like the output so this is not an option.`;
function timer(time) {
return new Promise(ok=>setTimeout(ok,time));
}
async function run() {
let i = 0;
process.stdout.on('error',err=>{
console.error('ERROR EN MAIN PROCESS',err);
});
setInterval(()=>{
console.error("LENGTH: ",process.stdout.writableLength);
},1000);
while(true) {
let msg = `[${i++}] ${MSG}\n`;
await new Promise((ok)=>{
setImmediate(()=>{
process.stdout.write(msg);
ok();
});
});
}
}
run();