Class SyslogAuditSink
- All Implemented Interfaces:
McpAuditSink
Select it with MCP_AUDIT_SINK=com.mcpdbwizard.pub.SyslogAuditSink. It needs no library:
syslog is a line on a socket, which is most of why it is worth having — nearly every SIEM already
listens for it, and adding one costs this project no dependency at all.
MCP_AUDIT_SYSLOG_HOST | Required. The collector. |
MCP_AUDIT_SYSLOG_PORT | Default 514. |
MCP_AUDIT_SYSLOG_PROTOCOL | tcp (default) or udp. |
MCP_AUDIT_SYSLOG_FACILITY | 0-23, default 13 (log audit). |
MCP_AUDIT_SYSLOG_APP_NAME | APP-NAME field, default "mcpdbwizard". |
Use TCP. UDP cannot tell you whether the trail is complete.
Over UDP a record is written to a socket and nothing ever comes back: a collector that is down, full, or behind a dropping firewall is indistinguishable from one that recorded everything. That is tolerable for logs and a poor fit for evidence, so the default is TCP and choosing UDP is warned about at start-up.
What flush() means here, precisely
It reports whether any send since the previous flush failed locally — a refused connection, a broken pipe, a socket error. It does not mean the collector indexed the record, because syslog has no acknowledgement in either transport; even over TCP the guarantee stops at the far end's kernel accepting the bytes.
That matters most in front of a spool. SpoolingAuditSink deletes a segment when
this returns true, so with syslog the spool protects against this process dying and
against the collector being unreachable, and not against a collector that accepts bytes
and discards them. Returning false unconditionally over UDP was considered and rejected: it would
be just as untrue, and it would make the spool grow until it hit its cap and began dropping
records — trading a small uncertainty for a certain loss.
Copyright 2003-2026 ATB Consultancy Services Ltd
(formerly Orinda Software Ltd, Dublin, Ireland)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBuilt reflectively byMcpAuditSinks.fromEnvironment().SyslogAuditSink(String theHostValue, int thePortValue, boolean theUdpFlagValue, int theFacilityValue, String theAppNameValue) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()describe()A short human description of what this sink is, for an operator reading a status page.booleanflush()Confirm that everything handed toMcpAuditSink.record(com.mcpdbwizard.pub.McpAuditEvent)since the last flush is durably accepted.longHow many records were confirmed delivered, or -1 when the sink does not report.longHow many records this sink is known to have LOST, or -1 when it does not report.voidrecord(McpAuditEvent theEvent) Record one call.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.mcpdbwizard.pub.McpAuditSink
getPendingCount
-
Field Details
-
HOST_VARIABLE
- See Also:
-
PORT_VARIABLE
- See Also:
-
PROTOCOL_VARIABLE
- See Also:
-
FACILITY_VARIABLE
- See Also:
-
APP_NAME_VARIABLE
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_FACILITY
public static final int DEFAULT_FACILITYFacility 13, "log audit". The one the RFC set aside for exactly this.- See Also:
-
DEFAULT_APP_NAME
- See Also:
-
-
Constructor Details
-
SyslogAuditSink
public SyslogAuditSink()Built reflectively byMcpAuditSinks.fromEnvironment(). -
SyslogAuditSink
-
-
Method Details
-
record
Record one call. Must not throw.Never throws.
- Specified by:
recordin interfaceMcpAuditSink- Parameters:
theEvent- the call to record; never null
-
flush
public boolean flush()Confirm that everything handed toMcpAuditSink.record(com.mcpdbwizard.pub.McpAuditEvent)since the last flush is durably accepted.This is what makes a spool possible. A spool writes each record to disk first and may only delete it once the sink has genuinely taken it — and for an asynchronous sink like Kafka,
recordreturning tells you nothing, because the send has not completed yet.The default returns true, which is correct for a sink that delivers synchronously inside
record. An asynchronous sink must override it, and must return false if anything since the last flush was lost — returning true on a failed batch would let a spool delete records that never arrived, which is the one way a spool can be worse than no spool.Compared against the count at the END OF THE PREVIOUS FLUSH, not the start of this one — the same rule
KafkaAuditSink.flush()documents at length.record(com.mcpdbwizard.pub.McpAuditEvent)fails synchronously here, so sampling the counter at the top of this method could not see a failure that had already happened, and a spool would delete a segment whose records never left the machine.- Specified by:
flushin interfaceMcpAuditSink- Returns:
- true if everything since the last flush is safely delivered
-
getDroppedCount
public long getDroppedCount()Description copied from interface:McpAuditSinkHow many records this sink is known to have LOST, or -1 when it does not report.The number an operator actually needs, and the one nothing surfaced before: a trail is only worth citing if it is complete, and "complete" is exactly what a drop count denies. Reported through the SPI rather than by casting to a particular sink so a status page keeps working when the sink is swapped.
-1 means "this sink does not count", which a caller must show differently from 0. Claiming zero losses on a sink that cannot tell is the one wrong answer here.
- Specified by:
getDroppedCountin interfaceMcpAuditSink
-
getDeliveredCount
public long getDeliveredCount()Description copied from interface:McpAuditSinkHow many records were confirmed delivered, or -1 when the sink does not report.- Specified by:
getDeliveredCountin interfaceMcpAuditSink
-
describe
Description copied from interface:McpAuditSinkA short human description of what this sink is, for an operator reading a status page.Defaults to the class name. A wrapper overrides it to name what it wraps — otherwise a spooled Kafka sink reports only "SpoolingAuditSink", and where the records finally go is the part being asked about.
- Specified by:
describein interfaceMcpAuditSink
-
close
public void close()- Specified by:
closein interfaceMcpAuditSink
-