fix: remove duplicate print() in _log() across all service templates
Every service's _log() called print() then write_syslog_file() which also calls print(), causing every log line to appear twice in Docker logs. The collector streamed both copies, doubling ingested events. Removed the redundant print() from all 22 service server.py files.
This commit is contained in:
@@ -62,7 +62,6 @@ _CONTAINERS = [
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ _ROOT_RESPONSE = {
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ BANNER = os.environ.get("FTP_BANNER", "220 (vsFTPd 3.0.3)")
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ def _fix_server_header(response):
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,6 @@ _MAILBOXES = ["INBOX", "Sent", "Drafts", "Archive"]
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ _SECRETS = {
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ LOG_TARGET = os.environ.get("LOG_TARGET", "")
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ LOG_TARGET = os.environ.get("LOG_TARGET", "")
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,6 @@ def _op_msg(request_id: int, doc: bytes) -> bytes:
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ _CONNACK_NOT_AUTH = b"\x20\x02\x00\x05"
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ _PRELOGIN_RESP = bytes([
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ def _make_packet(payload: bytes, seq: int = 0) -> bytes:
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ _BAIT_EMAILS: list[str] = [
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ def _error_response(message: str) -> bytes:
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ LOG_TARGET = os.environ.get("LOG_TARGET", "")
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ _FAKE_STORE = {
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ _401 = (
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ LOG_TARGET = os.environ.get("LOG_TARGET", "")
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ _SMTP_MTA = os.environ.get("SMTP_MTA", NODE_NAME)
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ _OID_VALUES = {
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ def _error_pkt(code: int, msg: str) -> bytes:
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ LOG_TARGET = os.environ.get("LOG_TARGET", "")
|
|||||||
|
|
||||||
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
def _log(event_type: str, severity: int = 6, **kwargs) -> None:
|
||||||
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
line = syslog_line(SERVICE_NAME, NODE_NAME, event_type, severity, **kwargs)
|
||||||
print(line, flush=True)
|
|
||||||
write_syslog_file(line)
|
write_syslog_file(line)
|
||||||
forward_syslog(line, LOG_TARGET)
|
forward_syslog(line, LOG_TARGET)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user