add check queue size
This commit is contained in:
11
main.py
11
main.py
@@ -231,6 +231,12 @@ class LogMonitor:
|
|||||||
# Add source file information
|
# Add source file information
|
||||||
log_data['source_file'] = source_file
|
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
|
# Send based on log type
|
||||||
if log_data['type'] == 'access':
|
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')}")
|
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)
|
self.logbull_logger.error("NGINX Error Log", fields=log_data)
|
||||||
|
|
||||||
logger.debug(f"LogBull message queued successfully (type={log_data['type']})")
|
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:
|
except Exception as e:
|
||||||
logger.error(f"Error sending to LogBull: {e}", exc_info=True)
|
logger.error(f"Error sending to LogBull: {e}", exc_info=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user