code: function logStashAppender(config, fields, layout) {
      var time = process.hrtime(),
          messages = [],
          timeOutId = 0;
  
      layout = layout || logstashLayout;
  
      //Setup the connection to logstash
      function pushToStash(config, msg) {
          var client = net.connect({host: config.host, port: config.port}, function () {
              client.write(msg);
              client.end();
          });
          //Fail silently
          client.on('error', function (evt) {
              if (true === config.debug) {
                  console.log('An error happened in the logstash appender!', evt);
              }
          });
      }
  
      return function (logEvt) {
          //do stuff with the logging event
          var data = layout(logEvt, fields);
  
          if (config.batch === true) {
              messages.push(data);
              clearTimeout(timeOutId);
              if ((process.hrtime(time)[0] >= config.batchTimeout || messages.length > config.batchSize)) {
                  pushToStash(config, messages.join(''));
                  time = process.hrtime();
                  messages = [];
              } else {
                  timeOutId = setTimeout(function () {
                      pushToStash(config, messages.join(''));
                      time = process.hrtime();
                      messages = [];
                  }, 1000);
              }
          } else {
              pushToStash(config, data);
          }
      };
  }
docs: The appender, Gives us the function used for log4js.
  It Supports batching of commands, we use the json_lines codec for this library,
  so the \n are mandatory
  
  @param config
  @param fields
  @param layout
  @returns {Function}