Improved log processing by adding index logging, client count logging, and client address logging when sending events.
This commit is contained in:
@@ -67,7 +67,8 @@ setInterval(async () => {
|
||||
logs = validLogs;
|
||||
if (Array.isArray(logs)) {
|
||||
console.log('Processing logs array');
|
||||
logs.forEach(log => {
|
||||
logs.forEach((log, index) => {
|
||||
console.log(`Processing log at index ${index}:`, log);
|
||||
const msgMatch = log._msg.match(/msg_hash=0x[0-9a-fA-F]+/);
|
||||
const timeMatch = log._msg.match(/receivedTime=\d+/);
|
||||
const nodeIdMatch = log.kubernetes_pod_name.match(/nodes-(\d+)/);
|
||||
@@ -95,8 +96,12 @@ setInterval(async () => {
|
||||
} else {
|
||||
console.log(`Sending "light up node ${logData.nodeId}" event to clients`);
|
||||
}
|
||||
|
||||
console.log('Number of connected clients:', wss.clients.size);
|
||||
|
||||
wss.clients.forEach(client => {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
console.log(`Sending event to client ${client._socket.remoteAddress}`);
|
||||
client.send(JSON.stringify(logData));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user