Skip to content

Instantly share code, notes, and snippets.

@smfreegard
Created August 29, 2017 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smfreegard/1335631ea18b875d3790eb5d8dc80973 to your computer and use it in GitHub Desktop.
Save smfreegard/1335631ea18b875d3790eb5d8dc80973 to your computer and use it in GitHub Desktop.
var logfmt = require('logfmt');
exports.remote = {
ip: '1.2.3.4',
host: 'a.b.foo.com',
}
exports.hello = {
host: 'FOO'
}
exports.relaying = false;
exports.early_talker = false;
exports.esmtp = true;
exports.tls = {
enabled: true
}
exports.pipelining = true;
exports.errors = 0;
exports.tran_count = 1;
exports.rcpt_count = {
accept: 1,
tempfail: 0,
reject: 0,
}
exports.msg_count = {
accept: 1,
tempfail: 0,
reject: 0,
}
exports.totalbytes = 1048576;
exports.start_time = Date.now() - 1000;
var logdetail = {
'ip': this.remote.ip,
'rdns': ((this.remote.host) ? this.remote.host : ''),
'helo': ((this.hello.host) ? this.hello.host : ''),
'relay': (this.relaying ? 'Y' : 'N'),
'early': (this.early_talker ? 'Y' : 'N'),
'esmtp': (this.esmtp ? 'Y' : 'N'),
'tls': (this.tls.enabled ? 'Y' : 'N'),
'pipe': (this.pipelining ? 'Y' : 'N'),
'errors': this.errors,
'txns': this.tran_count,
'rcpts': this.rcpt_count.accept + '/' +
this.rcpt_count.tempfail + '/' +
this.rcpt_count.reject,
'msgs': this.msg_count.accept + '/' +
this.msg_count.tempfail + '/' +
this.msg_count.reject,
'bytes': this.totalbytes,
'lr': ((this.last_reject) ? this.last_reject : ''),
'time': (Date.now() - this.start_time)/1000,
};
for (var i=0; i<1000000; i++) {
console.log(logfmt.stringify(logdetail));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment