add check queue size

This commit is contained in:
2026-03-03 21:57:27 +01:00
parent c721fdf9f2
commit 1ddcdad628

11
main.py
View File

@@ -231,6 +231,12 @@ class LogMonitor:
# Add source file information
log_data['source_file'] = source_file
# Log the full data being sent
logger.debug(f"Preparing to send log to LogBull:")
logger.debug(f" - Type: {log_data.get('type')}")
logger.debug(f" - Source: {source_file}")
logger.debug(f" - Full data: {log_data}")
# Send based on log type
if log_data['type'] == 'access':
logger.debug(f"Sending ACCESS log to LogBull: {log_data.get('method')} {log_data.get('path')} - {log_data.get('status')}")
@@ -244,6 +250,11 @@ class LogMonitor:
self.logbull_logger.error("NGINX Error Log", fields=log_data)
logger.debug(f"LogBull message queued successfully (type={log_data['type']})")
# Check queue size
if hasattr(self.logbull_logger, 'sender') and self.logbull_logger.sender:
queue_size = self.logbull_logger.sender._log_queue.qsize()
logger.debug(f"LogBull queue size: {queue_size}")
except Exception as e:
logger.error(f"Error sending to LogBull: {e}", exc_info=True)