Finish Logstash implementation

This commit is contained in:
Mark Veidemanis 2021-06-06 10:16:04 +00:00
parent 5d63d7a1e9
commit c389094365
3 changed files with 11 additions and 1 deletions

View File

@ -24,6 +24,10 @@
"User": "sir", "User": "sir",
"Password": "sir" "Password": "sir"
}, },
"Logstash": {
"Host": "10.0.0.2",
"Port": "4000"
},
"ChanKeep": { "ChanKeep": {
"MaxRelay": 30, "MaxRelay": 30,
"SigSwitch": 20 "SigSwitch": 20

View File

@ -3,6 +3,7 @@ from json import dumps
import main import main
from core.relay import sendRelayNotification from core.relay import sendRelayNotification
from core.logstash import sendLogstashNotification
from modules import userinfo from modules import userinfo
from modules import regproc from modules import regproc
from utils.dedup import dedup 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(): if "muser" in c.keys():
del c["muser"] 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)

View File

@ -25,6 +25,8 @@ from core.server import Server, ServerFactory
from core.relay import Relay, RelayFactory from core.relay import Relay, RelayFactory
import modules.counters import modules.counters
loadCommands() loadCommands()
import core.logstash
core.logstash.init_logstash()
if __name__ == "__main__": if __name__ == "__main__":
listener = ServerFactory() listener = ServerFactory()