mirror of
https://github.com/ptarmiganlabs/butler-sos.git
synced 2025-12-19 17:58:18 -05:00
feat: Enhance logging for incoming UDP log events
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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)}`);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user