Socket
Socket
Sign inDemoInstall

haraka-plugin-elasticsearch

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haraka-plugin-elasticsearch - npm Package Compare versions

Comparing version 8.0.2 to 8.0.3

CHANGELOG.md

727

index.js

@@ -1,475 +0,476 @@

'use strict';
'use strict'
// log to Elasticsearch
const util = require('util');
const utils = require('haraka-utils');
const Elasticsearch = require('@elastic/elasticsearch');
const util = require('util')
const utils = require('haraka-utils')
const Elasticsearch = require('@elastic/elasticsearch')
exports.register = function () {
this.load_es_ini()
this.load_es_ini();
this.es_connect(err => {
if (err) return;
this.register_hook('reset_transaction', 'log_transaction');
this.register_hook('disconnect', 'log_connection');
})
this.es_connect((err) => {
if (err) return
this.register_hook('reset_transaction', 'log_transaction')
this.register_hook('disconnect', 'log_connection')
})
}
exports.load_es_ini = function () {
this.cfg = this.config.get('elasticsearch.ini', {
booleans: [
'+main.log_connections',
'*.rejectUnauthorized'
]
this.cfg = this.config.get(
'elasticsearch.ini',
{
booleans: ['+main.log_connections', '*.rejectUnauthorized'],
},
() => {
this.load_es_ini();
})
this.load_es_ini()
},
)
this.get_es_hosts();
this.get_es_hosts()
if (this.cfg.ignore_hosts) {
// convert bare entries (w/undef values) to true
for (const h in this.cfg.ignore_hosts) {
if (!this.cfg.ignore_hosts[h]) this.cfg.ignore_hosts[h]=true;
}
if (this.cfg.ignore_hosts) {
// convert bare entries (w/undef values) to true
for (const h in this.cfg.ignore_hosts) {
if (!this.cfg.ignore_hosts[h]) this.cfg.ignore_hosts[h] = true
}
}
this.cfg.headers = this.cfg.headers ? Object.keys(this.cfg.headers) : ['From', 'To', 'Subject'];
this.cfg.headers = this.cfg.headers
? Object.keys(this.cfg.headers)
: ['From', 'To', 'Subject']
this.cfg.conn_props = this.cfg.connection_properties ||
{ relaying:undefined,
totalbytes:undefined,
pipelining:undefined,
early_talker:undefined,
};
this.cfg.conn_props = this.cfg.connection_properties || {
relaying: undefined,
totalbytes: undefined,
pipelining: undefined,
early_talker: undefined,
}
}
exports.get_es_hosts = function () {
const plugin = this;
plugin.cfg.es_hosts = []; // default: http://localhost:9200
const plugin = this
plugin.cfg.es_hosts = [] // default: http://localhost:9200
if (!plugin.cfg.hosts) return; // no [hosts] config
if (!plugin.cfg.hosts) return // no [hosts] config
for (const host in plugin.cfg.hosts) {
if (plugin.cfg.hosts[host]) {
plugin.cfg.es_hosts.push(plugin.cfg.hosts[host]);
}
else {
plugin.cfg.es_hosts.push(`http://${host}:9200`);
}
for (const host in plugin.cfg.hosts) {
if (plugin.cfg.hosts[host]) {
plugin.cfg.es_hosts.push(plugin.cfg.hosts[host])
} else {
plugin.cfg.es_hosts.push(`http://${host}:9200`)
}
}
plugin.clientArgs = { nodes: plugin.cfg.es_hosts };
if (plugin.cfg.auth) plugin.clientArgs.auth = plugin.cfg.auth;
if (plugin.cfg.tls) plugin.clientArgs.tls = plugin.cfg.tls;
plugin.clientArgs = { nodes: plugin.cfg.es_hosts }
if (plugin.cfg.auth) plugin.clientArgs.auth = plugin.cfg.auth
if (plugin.cfg.tls) plugin.clientArgs.tls = plugin.cfg.tls
}
exports.es_connect = function (done) {
const plugin = this;
const plugin = this
plugin.es = new Elasticsearch.Client(plugin.clientArgs);
plugin.es = new Elasticsearch.Client(plugin.clientArgs)
plugin.es.ping()
.then(() => {
plugin.lognotice('connected')
})
.catch(error => {
plugin.logerror('cluster is down!')
plugin.logerror(util.inspect(error, {depth: null}))
})
.finally(() => {
if (done) done()
})
plugin.es
.ping()
.then(() => {
plugin.lognotice('connected')
})
.catch((error) => {
plugin.logerror('cluster is down!')
plugin.logerror(util.inspect(error, { depth: null }))
})
.finally(() => {
if (done) done()
})
}
exports.log_transaction = function (next, connection) {
const plugin = this;
const plugin = this
if (plugin.cfg.ignore_hosts) {
if (plugin.cfg.ignore_hosts[connection.remote.host]) return next();
}
if (plugin.cfg.ignore_hosts) {
if (plugin.cfg.ignore_hosts[connection.remote.host]) return next()
}
const res = plugin.get_plugin_results(connection);
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.message) {
res[plugin.cfg.top_level_names.message] = res.message;
delete res.message;
}
res.timestamp = new Date().toISOString();
const res = plugin.get_plugin_results(connection)
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.message) {
res[plugin.cfg.top_level_names.message] = res.message
delete res.message
}
res.timestamp = new Date().toISOString()
plugin.populate_conn_properties(connection, res);
plugin.es.create({
index: plugin.getIndexName('transaction'),
id: connection.transaction.uuid,
document: res,
plugin.populate_conn_properties(connection, res)
plugin.es
.create({
index: plugin.getIndexName('transaction'),
id: connection.transaction.uuid,
document: res,
})
.then((response) => {
// connection.loginfo(plugin, response);
})
.catch(error => {
connection.logerror(plugin, error.message);
})
.then((response) => {
// connection.loginfo(plugin, response);
})
.catch((error) => {
connection.logerror(plugin, error.message)
})
// hook reset_transaction doesn't seem to wait for next(). If I
// wait until after I get a response back from ES, Haraka throws
// "Error: We are already running hooks!". So, record that we've sent
// to ES (so connection isn't saved) and hope for the best.
connection.notes.elasticsearch=connection.tran_count;
next();
// hook reset_transaction doesn't seem to wait for next(). If I
// wait until after I get a response back from ES, Haraka throws
// "Error: We are already running hooks!". So, record that we've sent
// to ES (so connection isn't saved) and hope for the best.
connection.notes.elasticsearch = connection.tran_count
next()
}
exports.log_connection = function (next, connection) {
const plugin = this;
if (!plugin.cfg.main.log_connections) return next();
const plugin = this
if (!plugin.cfg.main.log_connections) return next()
if (plugin.cfg.ignore_hosts) {
if (plugin.cfg.ignore_hosts[connection.remote_host]) return next();
}
if (plugin.cfg.ignore_hosts) {
if (plugin.cfg.ignore_hosts[connection.remote_host]) return next()
}
if (connection.notes.elasticsearch &&
connection.notes.elasticsearch === connection.tran_count) {
connection.logdebug(plugin, 'skipping already logged txn');
return next();
}
if (
connection.notes.elasticsearch &&
connection.notes.elasticsearch === connection.tran_count
) {
connection.logdebug(plugin, 'skipping already logged txn')
return next()
}
const res = plugin.get_plugin_results(connection);
res.timestamp = new Date().toISOString();
const res = plugin.get_plugin_results(connection)
res.timestamp = new Date().toISOString()
plugin.populate_conn_properties(connection, res);
plugin.populate_conn_properties(connection, res)
// connection.lognotice(plugin, JSON.stringify(res));
plugin.es.create({
index: plugin.getIndexName('connection'),
id: connection.uuid,
document: res,
// connection.lognotice(plugin, JSON.stringify(res));
plugin.es
.create({
index: plugin.getIndexName('connection'),
id: connection.uuid,
document: res,
})
.then((response) => {
// connection.loginfo(plugin, response);
})
.catch(error => {
connection.logerror(plugin, error.message);
})
.then((response) => {
// connection.loginfo(plugin, response);
})
.catch((error) => {
connection.logerror(plugin, error.message)
})
next()
next()
}
exports.objToArray = function (obj) {
const arr = [];
if (!obj || typeof obj !== 'object') return arr;
for (const k in obj) {
arr.push({ k, v: obj[k] });
}
return arr;
const arr = []
if (!obj || typeof obj !== 'object') return arr
for (const k in obj) {
arr.push({ k, v: obj[k] })
}
return arr
}
exports.getIndexName = function (section) {
const plugin = this;
const plugin = this
// Elasticsearch indexes named like: smtp-connection-2017-05-05
// smtp-transaction-2017-05-05
let name = `smtp-${section}`;
if (plugin.cfg.index && plugin.cfg.index[section]) {
name = plugin.cfg.index[section];
}
const date = new Date();
const d = date.getUTCDate().toString().padStart(2, '0');
const m = (date.getUTCMonth() + 1).toString().padStart(2, '0');
return `${name}-${date.getUTCFullYear()}-${m}-${d}`;
// Elasticsearch indexes named like: smtp-connection-2017-05-05
// smtp-transaction-2017-05-05
let name = `smtp-${section}`
if (plugin.cfg.index && plugin.cfg.index[section]) {
name = plugin.cfg.index[section]
}
const date = new Date()
const d = date.getUTCDate().toString().padStart(2, '0')
const m = (date.getUTCMonth() + 1).toString().padStart(2, '0')
return `${name}-${date.getUTCFullYear()}-${m}-${d}`
}
exports.populate_conn_properties = function (conn, res) {
const plugin = this;
let conn_res = res;
const plugin = this
let conn_res = res
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.connection) {
if (!res[plugin.cfg.top_level_names.connection]) {
res[plugin.cfg.top_level_names.connection] = {};
}
conn_res = res[plugin.cfg.top_level_names.connection];
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.connection) {
if (!res[plugin.cfg.top_level_names.connection]) {
res[plugin.cfg.top_level_names.connection] = {}
}
conn_res = res[plugin.cfg.top_level_names.connection]
}
conn_res.local = {
ip: conn.local.ip,
port: conn.local.port,
host: plugin.cfg.hostname || require('os').hostname(),
};
conn_res.remote = {
ip: conn.remote.ip,
host: conn.remote.host,
port: conn.remote.port,
};
conn_res.hello = {
host: conn.hello.host,
verb: conn.hello.verb,
};
conn_res.tls = {
enabled: conn.tls.enabled,
};
conn_res.local = {
ip: conn.local.ip,
port: conn.local.port,
host: plugin.cfg.hostname || require('os').hostname(),
}
conn_res.remote = {
ip: conn.remote.ip,
host: conn.remote.host,
port: conn.remote.port,
}
conn_res.hello = {
host: conn.hello.host,
verb: conn.hello.verb,
}
conn_res.tls = {
enabled: conn.tls.enabled,
}
if (!conn_res.auth) {
conn_res.auth = {};
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.plugin) {
const pia = plugin.cfg.top_level_names.plugin;
if (res[pia] && res[pia].auth) {
conn_res.auth = res[pia].auth;
delete res[pia].auth;
}
}
else {
if (res.auth) {
conn_res.auth = res.auth;
delete res.auth;
}
}
if (!conn_res.auth) {
conn_res.auth = {}
if (plugin.cfg.top_level_names && plugin.cfg.top_level_names.plugin) {
const pia = plugin.cfg.top_level_names.plugin
if (res[pia] && res[pia].auth) {
conn_res.auth = res[pia].auth
delete res[pia].auth
}
} else {
if (res.auth) {
conn_res.auth = res.auth
delete res.auth
}
}
}
conn_res.count = {
errors: conn.errors,
msg: conn.msg_count,
rcpt: conn.rcpt_count,
trans: conn.tran_count,
};
conn_res.count = {
errors: conn.errors,
msg: conn.msg_count,
rcpt: conn.rcpt_count,
trans: conn.tran_count,
}
for (const f in plugin.cfg.conn_props) {
if (conn[f] === undefined) return;
if (conn[f] === 0) return;
if (plugin.cfg.conn_props[f]) { // alias specified
conn_res[plugin.cfg.conn_props[f]] = conn[f];
}
else {
conn_res[f] = conn[f];
}
for (const f in plugin.cfg.conn_props) {
if (conn[f] === undefined) return
if (conn[f] === 0) return
if (plugin.cfg.conn_props[f]) {
// alias specified
conn_res[plugin.cfg.conn_props[f]] = conn[f]
} else {
conn_res[f] = conn[f]
}
}
conn_res.duration = (Date.now() - conn.start_time)/1000;
conn_res.duration = (Date.now() - conn.start_time) / 1000
}
exports.get_plugin_results = function (connection) {
let name;
let name
// make a copy of the result store, so subsequent changes don't alter the original (by reference)
const pir = JSON.parse(JSON.stringify(connection.results.get_all()));
for (name in pir) { this.trim_plugin_name(pir, name); }
for (name in pir) {
this.prune_noisy(pir, name);
this.prune_empty(pir[name]);
this.prune_zero(pir, name);
this.prune_redundant_cxn(pir, name);
}
// make a copy of the result store, so subsequent changes don't alter the original (by reference)
const pir = JSON.parse(JSON.stringify(connection.results.get_all()))
for (name in pir) {
this.trim_plugin_name(pir, name)
}
for (name in pir) {
this.prune_noisy(pir, name)
this.prune_empty(pir[name])
this.prune_zero(pir, name)
this.prune_redundant_cxn(pir, name)
}
if (!connection.transaction) return this.nest_plugin_results(pir);
if (!connection.transaction) return this.nest_plugin_results(pir)
let txr;
try {
txr = JSON.parse(JSON.stringify(connection.transaction.results.get_all()));
}
catch (e) {
connection.transaction.results.add(this, {err: e.message });
return this.nest_plugin_results(pir);
}
let txr
try {
txr = JSON.parse(JSON.stringify(connection.transaction.results.get_all()))
} catch (e) {
connection.transaction.results.add(this, { err: e.message })
return this.nest_plugin_results(pir)
}
for (name in txr) {
this.trim_plugin_name(txr, name);
}
for (name in txr) {
this.prune_noisy(txr, name);
this.prune_empty(txr[name]);
this.prune_zero(txr, name);
this.prune_redundant_txn(txr, name);
}
for (name in txr) {
this.trim_plugin_name(txr, name)
}
for (name in txr) {
this.prune_noisy(txr, name)
this.prune_empty(txr[name])
this.prune_zero(txr, name)
this.prune_redundant_txn(txr, name)
}
// merge transaction results into connection results
for (name in txr) {
if (!pir[name]) {
pir[name] = txr[name];
}
else {
utils.extend(pir[name], txr[name]);
}
delete txr[name];
// merge transaction results into connection results
for (name in txr) {
if (!pir[name]) {
pir[name] = txr[name]
} else {
utils.extend(pir[name], txr[name])
}
delete txr[name]
}
this.populate_message(pir, connection);
return this.nest_plugin_results(pir);
this.populate_message(pir, connection)
return this.nest_plugin_results(pir)
}
exports.populate_message = function (pir, connection) {
const plugin = this;
pir.message = {
bytes: connection.transaction.data_bytes,
envelope: {
sender: '',
recipient: [],
},
header: {},
body: {
attachment: [],
},
queue: {},
};
const plugin = this
pir.message = {
bytes: connection.transaction.data_bytes,
envelope: {
sender: '',
recipient: [],
},
header: {},
body: {
attachment: [],
},
queue: {},
}
if (pir.mail_from && pir.mail_from.address) {
pir.message.envelope.sender = pir.mail_from.address.toLowerCase();
delete pir.mail_from.address;
}
if (pir.mail_from && pir.mail_from.address) {
pir.message.envelope.sender = pir.mail_from.address.toLowerCase()
delete pir.mail_from.address
}
if (pir.rcpt_to && pir.rcpt_to.recipient) {
for (const key in pir.rcpt_to.recipient) {
pir.rcpt_to.recipient[key].address=pir.rcpt_to.recipient[key].address.toLowerCase();
}
pir.message.envelope.recipient = pir.rcpt_to.recipient;
delete pir.rcpt_to;
if (pir.rcpt_to && pir.rcpt_to.recipient) {
for (const key in pir.rcpt_to.recipient) {
pir.rcpt_to.recipient[key].address =
pir.rcpt_to.recipient[key].address.toLowerCase()
}
pir.message.envelope.recipient = pir.rcpt_to.recipient
delete pir.rcpt_to
}
if (pir.attachment && pir.attachment.attach) {
pir.message.body.attachment = pir.attachment.attach;
delete pir.attachment;
}
if (pir.queue) {
pir.message.queue = pir.queue;
delete pir.queue;
}
if (pir.attachment && pir.attachment.attach) {
pir.message.body.attachment = pir.attachment.attach
delete pir.attachment
}
if (pir.queue) {
pir.message.queue = pir.queue
delete pir.queue
}
plugin.cfg.headers.forEach(function (h) {
const r = connection.transaction.header.get_decoded(h);
if (!r) return;
pir.message.header[h] = r;
});
plugin.cfg.headers.forEach(function (h) {
const r = connection.transaction.header.get_decoded(h)
if (!r) return
pir.message.header[h] = r
})
}
exports.nest_plugin_results = function (res) {
const plugin = this;
if (!plugin.cfg.top_level_names) return res;
if (!plugin.cfg.top_level_names.plugin) return res;
const plugin = this
if (!plugin.cfg.top_level_names) return res
if (!plugin.cfg.top_level_names.plugin) return res
const new_res = {};
if (res.message) {
new_res.message = res.message;
delete res.message;
}
new_res[plugin.cfg.top_level_names.plugin] = res;
return new_res;
const new_res = {}
if (res.message) {
new_res.message = res.message
delete res.message
}
new_res[plugin.cfg.top_level_names.plugin] = res
return new_res
}
exports.trim_plugin_name = function (res, name) {
let trimmed = name;
let trimmed = name
const parts = name.split('.');
if (parts.length > 1) {
switch (parts[0]) {
case 'helo':
trimmed = 'helo';
break;
// for names like: data.headers or connect.geoip, strip off the phase prefix
case 'connect':
case 'mail_from':
case 'rcpt_to':
case 'data':
trimmed = parts.slice(1).join('.');
}
const parts = name.split('.')
if (parts.length > 1) {
switch (parts[0]) {
case 'helo':
trimmed = 'helo'
break
// for names like: data.headers or connect.geoip, strip off the phase prefix
case 'connect':
case 'mail_from':
case 'rcpt_to':
case 'data':
trimmed = parts.slice(1).join('.')
}
if (trimmed === name) return;
}
if (trimmed === name) return
res[trimmed] = res[name];
delete res[name];
name = trimmed;
res[trimmed] = res[name]
delete res[name]
name = trimmed
}
exports.prune_empty = function (pi) {
// remove undefined keys and empty strings, arrays, or objects
for (const e in pi) {
const val = pi[e]
if (val === undefined || val === null) {
delete pi[e]
continue
}
// remove undefined keys and empty strings, arrays, or objects
for (const e in pi) {
const val = pi[e];
if (val === undefined || val === null) {
delete pi[e];
continue;
}
if (typeof val === 'string') {
if (val === '') delete pi[e];
}
else if (Array.isArray(val)) {
if (val.length === 0) delete pi[e];
}
else if (typeof val === 'object') {
if (Object.keys(val).length === 0) delete pi[e];
}
if (typeof val === 'string') {
if (val === '') delete pi[e]
} else if (Array.isArray(val)) {
if (val.length === 0) delete pi[e]
} else if (typeof val === 'object') {
if (Object.keys(val).length === 0) delete pi[e]
}
}
}
exports.prune_noisy = function (res, pi) {
const plugin = this;
const plugin = this
if (res[pi].human) delete res[pi].human;
if (res[pi].human_html) delete res[pi].human_html;
if (res[pi]._watch_saw) delete res[pi]._watch_saw;
if (res[pi].human) delete res[pi].human
if (res[pi].human_html) delete res[pi].human_html
if (res[pi]._watch_saw) delete res[pi]._watch_saw
switch (pi) {
case 'karma':
delete res.karma.todo;
delete res.karma.pass;
delete res.karma.skip;
break;
case 'access':
delete res.access.pass;
break;
case 'uribl':
delete res.uribl.skip;
delete res.uribl.pass;
break;
case 'dnsbl':
delete res.dnsbl.pass;
break;
case 'fcrdns':
res.fcrdns.ptr_name_to_ip = plugin.objToArray(res.fcrdns.ptr_name_to_ip);
break;
case 'geoip':
delete res.geoip.ll;
break;
case 'max_unrecognized_commands':
res.unrecognized_commands = res.max_unrecognized_commands.count;
delete res.max_unrecognized_commands;
break;
case 'spamassassin':
delete res.spamassassin.line0;
if (res.spamassassin.headers) {
delete res.spamassassin.headers.Tests;
delete res.spamassassin.headers.Level;
}
break;
case 'rspamd':
if (res.rspamd.symbols) delete res.rspamd.symbols;
break;
}
switch (pi) {
case 'karma':
delete res.karma.todo
delete res.karma.pass
delete res.karma.skip
break
case 'access':
delete res.access.pass
break
case 'uribl':
delete res.uribl.skip
delete res.uribl.pass
break
case 'dnsbl':
delete res.dnsbl.pass
break
case 'fcrdns':
res.fcrdns.ptr_name_to_ip = plugin.objToArray(res.fcrdns.ptr_name_to_ip)
break
case 'geoip':
delete res.geoip.ll
break
case 'max_unrecognized_commands':
res.unrecognized_commands = res.max_unrecognized_commands.count
delete res.max_unrecognized_commands
break
case 'spamassassin':
delete res.spamassassin.line0
if (res.spamassassin.headers) {
delete res.spamassassin.headers.Tests
delete res.spamassassin.headers.Level
}
break
case 'rspamd':
if (res.rspamd.symbols) delete res.rspamd.symbols
break
}
}
exports.prune_zero = function (res, name) {
for (const e in res[name]) {
if (res[name][e] === 0) delete res[name][e];
}
for (const e in res[name]) {
if (res[name][e] === 0) delete res[name][e]
}
}
exports.prune_redundant_cxn = function (res, name) {
switch (name) {
case 'helo':
if (res.helo && res.helo.helo_host) delete res.helo.helo_host;
break;
case 'p0f':
if (res.p0f && res.p0f.query) delete res.p0f.query;
break;
}
switch (name) {
case 'helo':
if (res.helo && res.helo.helo_host) delete res.helo.helo_host
break
case 'p0f':
if (res.p0f && res.p0f.query) delete res.p0f.query
break
}
}
exports.prune_redundant_txn = function (res, name) {
switch (name) {
case 'spamassassin':
if (!res.spamassassin) break;
delete res.spamassassin.hits;
if (!res.spamassassin.headers) break;
if (!res.spamassassin.headers.Flag) break;
delete res.spamassassin.headers.Flag;
break;
}
switch (name) {
case 'spamassassin':
if (!res.spamassassin) break
delete res.spamassassin.hits
if (!res.spamassassin.headers) break
if (!res.spamassassin.headers.Flag) break
delete res.spamassassin.headers.Flag
break
}
}
{
"name": "haraka-plugin-elasticsearch",
"version": "8.0.2",
"version": "8.0.3",
"description": "Haraka plugin that saves logs to Elasticsearch",
"files": [
"CHANGELOG.md",
"config",
"index-templates"
],
"main": "index.js",
"scripts": {
"lint": "npx eslint *.js test",
"lintfix": "npx eslint --fix *.js test",
"test": "npx mocha",
"lint": "npx eslint@^8 *.js test",
"lint:fix": "npx eslint@^8 --fix *.js test",
"prettier": "npx prettier . --check",
"prettier:fix": "npx prettier . --write --log-level=warn",
"test": "npx mocha@^10",
"versions": "npx dependency-version-checker check"

@@ -28,11 +35,9 @@ },

"dependencies": {
"@elastic/elasticsearch": "^8.8.0",
"haraka-utils": "*"
"@elastic/elasticsearch": "^8.15.0",
"haraka-utils": "^1.1.3"
},
"devDependencies": {
"eslint": "^8.0.0",
"eslint-plugin-haraka": "*",
"haraka-test-fixtures": "^1.3.0",
"mocha": "^9.0.0"
"@haraka/eslint-config": "^1.1.5",
"haraka-test-fixtures": "^1.3.7"
}
}

@@ -28,3 +28,2 @@ [![Build Status][ci-img]][ci-url]

# Logging

@@ -40,4 +39,4 @@

* Elasticsearch cluster is down!
* No Living connections
- Elasticsearch cluster is down!
- No Living connections

@@ -48,4 +47,4 @@ However, ES will continue attempting to connect and when the ES server(s) are

* No Living connections
* Request Timeout after 30000ms
- No Living connections
- Request Timeout after 30000ms

@@ -56,7 +55,7 @@ They normally fix themselves when ES resumes working properly.

* host - an IP or hostname of the ES server to connect to
- host - an IP or hostname of the ES server to connect to
host=127.0.0.2
host=127.0.0.2
* pluginObject
- pluginObject

@@ -69,5 +68,4 @@ By default, all plugin results are presented as `$plugin_name: { ... }`, at

- [ignore_hosts]
* [ignore_hosts]
A config file section for hosts whose results should not be stored in

@@ -77,6 +75,6 @@ ES. HAproxy servers, Nagios, and other hosts who monitor Haraka can be listed

* [index]
- [index]
transaction=smtp-transaction
connection=smtp-connection
transaction=smtp-transaction
connection=smtp-connection

@@ -90,3 +88,2 @@ Transactions include all the connection information and are "the good stuff."

# Index map template

@@ -99,7 +96,7 @@

```sh
curl -X PUT 'http://localhost:9200/_template/haraka_results' -H 'Content-Type: application/json' -d @index-map-template.json
curl -X PUT 'http://localhost:9200/_template/haraka_results' -H 'Content-Type: application/json' -d @index-template/v8.json
```
<!-- leave these buried at the bottom of the document -->
<!-- leave these buried at the bottom of the document -->
[ci-img]: https://github.com/haraka/haraka-plugin-elasticsearch/actions/workflows/ci.yml/badge.svg

@@ -106,0 +103,0 @@ [ci-url]: https://github.com/haraka/haraka-plugin-elasticsearch/actions/workflows/ci.yml

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc