Implement ingesting to Redis from Threshold

This commit is contained in:
2022-09-07 07:20:30 +01:00
parent e3b2e1f36d
commit 79b1bee9e4
10 changed files with 46 additions and 50 deletions

View File

@@ -1,5 +1,6 @@
import json
import main
from core.logstash import sendLogstashNotification
from core.relay import sendRelayNotification
from modules import userinfo
from utils.dedup import dedup
@@ -64,6 +65,12 @@ def parsemeta(numName, c):
)
def queue_message(c):
message = json.dumps(c)
print("APPENDING MESSAGE", message)
main.g.sadd(main.config["Ingest"]["Key"], message)
def event(
numName, c
): # yes I'm using a short variable because otherwise it goes off the screen
@@ -75,8 +82,9 @@ def event(
if "muser" in c.keys():
del c["muser"]
sortedKeys = {k: c[k] for k in order if k in c} # Sort dict keys according to order
sortedKeys["src"] = "irc"
if main.config["Logstash"]["Enabled"]:
sendLogstashNotification(sortedKeys)
sendRelayNotification(sortedKeys)
# sortedKeys = {k: c[k] for k in order if k in c} # Sort dict keys according to order
# sortedKeys["src"] = "irc"
c["src"] = "irc"
if main.config["Ingest"]["Enabled"]:
queue_message(c)
sendRelayNotification(c)