Implement ingesting to Redis from Threshold
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user