feat: Enhance logging for incoming UDP log events

This commit is contained in:
Göran Sander
2025-12-09 15:43:41 +01:00
parent 2198485571
commit 02858c2ed3
4 changed files with 17 additions and 3 deletions

View File

@@ -226,7 +226,9 @@ async function mainScript() {
if (
globals.config.get('Butler-SOS.logEvents.source.repository.enable') ||
globals.config.get('Butler-SOS.logEvents.source.scheduler.enable') ||
globals.config.get('Butler-SOS.logEvents.source.proxy.enable')
globals.config.get('Butler-SOS.logEvents.source.proxy.enable') ||
globals.config.get('Butler-SOS.logEvents.source.engine.enable') ||
globals.config.get('Butler-SOS.logEvents.source.qixPerf.enable')
) {
udpInitLogEventServer();

View File

@@ -484,7 +484,7 @@ Configuration File:
// Prepare to listen on port X for incoming UDP connections regarding user activity events
this.udpServerUserActivity.socket = dgram.createSocket({
type: 'udp4',
reuseAddr: true,
reuseAddr: false,
});
this.udpServerUserActivity.portUserActivity = this.config.get(
@@ -508,7 +508,7 @@ Configuration File:
// Prepare to listen on port X for incoming UDP connections regarding user activity events
this.udpServerLogEvents.socket = dgram.createSocket({
type: 'udp4',
reuseAddr: true,
reuseAddr: false,
});
this.udpServerLogEvents.port = this.config.get(

View File

@@ -126,6 +126,10 @@ export async function messageEventHandler(message, _remote) {
globals.logger.debug('LOG EVENT: Calling log event New Relic posting method');
postLogEventToNewRelic(msgObj);
}
} else {
globals.logger.debug(
`LOG EVENT: Log event source not recognized or not enabled in configuration, skipping message: ${msgParts[0]}`
);
}
} catch (err) {
globals.logger.error(`LOG EVENT: Error handling message: ${globals.getErrorMessage(err)}`);

View File

@@ -22,6 +22,14 @@ export function udpInitLogEventServer() {
// Handler for UDP messages relating to log events
globals.udpServerLogEvents.socket.on('message', async (message, remote) => {
try {
globals.logger.debug(`[UDP LOG EVENT MSG] !!! RAW MESSAGE EVENT !!!`);
globals.logger.debug(`[UDP LOG EVENT MSG] From: ${remote.address}:${remote.port}`);
globals.logger.debug(`[UDP LOG EVENT MSG] Length: ${message.length} bytes`);
globals.logger.debug(
`[UDP LOG EVENT MSG] First 200 chars: ${message.toString().substring(0, 200)}`
);
globals.logger.debug(`[UDP LOG EVENT MSG] ---`);
// Get queue manager
const queueManager = globals.udpQueueManagerLogEvents;