title: NodeJS winston logging large number of writes bogs down
body: <p>Node JS - 12.7
  Winston - 1.0.1</p>
  
  <p>I am struggling with trying to generate "fake" log files representing many "devices". Basically I am going to use the data for testing and visualization in Kibana.</p>
  
  <p>I set my Winston up to log to file as so:</p>
  
  <pre><code>var winston = require('winston');
  
  var logger = new (winston.Logger)({
  transports: [
      new (winston.transports.File)({
          filename: 'logs/dsm.log'
      })
    ]
  });
  </code></pre>
  
  <p>So I have an array of devices which is just a list 12-byte hashes like: <code>AB4576D4C6AC</code>, etc.</p>
  
  <p>I am looping through the device array and assembling my "fake" log entry like so:</p>
  
  <pre><code>for (var i = 0; i &lt; devices.length; i++) {
      var timeStmp = startDateTime.clone().add((i * config.dsmIntervalMinutes), "m");
      dsm = {
          deviceId: devices[i].deviceId,
          msg: "some log entry text",
          timeStmp: timeStmp
      };
      logger.info(dsm);
  }
  </code></pre>
  
  <p>As you can see, I end by logging the message as <code>info</code> to Winston after each DSM is created in the loop.</p>
  
  <p>So this seems to work fine, except when I have a large number of devices. I want to get up to 1m devices or so. I am currently struggling to do 100k.</p>
  
  <p>What I see is that the node process is not writing the logs to the log file. It seems to be storing them all in memory (as seen by using <code>top</code>) and once it gets to 10k or so it slows to a crawl and eventually stops progressing. The log file is never written.</p>
  
  <p>So I am wondering if there is a way to do this? Can I somehow force node/winston to stop and write to disk every once in a while? Like flush the cache? I don't see options in winston for this.</p>
  
  <p>Any help would be greatly appreciated!</p>