From c38909436539c6982e5336d3af81fea206b0b841 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 6 Jun 2021 10:16:04 +0000 Subject: [PATCH] Finish Logstash implementation --- conf/example/config.json | 4 ++++ modules/monitor.py | 6 +++++- threshold | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/conf/example/config.json b/conf/example/config.json index 348af88..9471a47 100644 --- a/conf/example/config.json +++ b/conf/example/config.json @@ -24,6 +24,10 @@ "User": "sir", "Password": "sir" }, + "Logstash": { + "Host": "10.0.0.2", + "Port": "4000" + }, "ChanKeep": { "MaxRelay": 30, "SigSwitch": 20 diff --git a/modules/monitor.py b/modules/monitor.py index e9dea5a..2dbfc2e 100644 --- a/modules/monitor.py +++ b/modules/monitor.py @@ -3,6 +3,7 @@ from json import dumps import main from core.relay import sendRelayNotification +from core.logstash import sendLogstashNotification from modules import userinfo from modules import regproc from utils.dedup import dedup @@ -47,4 +48,7 @@ def event(numName, c): # yes I'm using a short variable because otherwise it goe if "muser" in c.keys(): del c["muser"] - sendRelayNotification({k: c[k] for k in order if k in c}) # Sort dict keys according to order + sortedKeys = {k: c[k] for k in order if k in c} # Sort dict keys according to order + sortedKeys["src"] = "irc" + sendLogstashNotification(sortedKeys) + sendRelayNotification(sortedKeys) diff --git a/threshold b/threshold index 59e9fab..46c0770 100755 --- a/threshold +++ b/threshold @@ -25,6 +25,8 @@ from core.server import Server, ServerFactory from core.relay import Relay, RelayFactory import modules.counters loadCommands() +import core.logstash +core.logstash.init_logstash() if __name__ == "__main__": listener = ServerFactory()