Troubleshooting
Common errors and solutions when using kafka-log-analyzer.
Error Code Reference
| Error Code | Description | Common Cause |
|---|---|---|
INVALID_INPUT | Missing or invalid input parameters | Required field not provided |
FILE_NOT_FOUND | Log file does not exist | Wrong file path or insufficient permissions |
PROMETHEUS_UNAVAILABLE | Cannot connect to Prometheus | Prometheus URL incorrect or service down |
LOKI_UNAVAILABLE | Cannot connect to Loki | Loki URL incorrect or service down |
HOOK_ERROR | Hook server operation failed | Port conflict or webhook misconfiguration |
PUSH_ERROR | Push notification failed | Webhook URL invalid or target unreachable |
JIRA_ERROR | JIRA integration failed | JIRA URL/token incorrect |
DATABASE_ERROR | SQLite operation failed | Storage directory unwritable |
Python Dependency Issues
kafka-log-analyzer requires Python 3.8+ for log analysis.
Python not found
Error: Python script failed: python3: command not foundSolution:
Install Python 3.8+:
bash# macOS brew install python3 # Ubuntu/Debian sudo apt install python3 # RHEL/CentOS sudo yum install python3Or set
pythonLocationenvironment variable if using a custom install:bashexport pythonLocation=/path/to/python/installation
Wrong Python version
Error: Python script failed: SyntaxError: invalid syntaxSolution: Ensure Python 3.8+ is installed:
python3 --version
# Should show 3.8.x or higherConnection Troubleshooting
Prometheus Connection Failed
WARN: Prometheus unavailable: fetch failedChecklist:
Verify Prometheus is running:
bashcurl http://localhost:9090/-/healthyCheck
PROMETHEUS_URLenvironment variable:bashecho $PROMETHEUS_URL # Should be like http://prometheus-server:9090Ensure network connectivity from the analyzer host to Prometheus.
Loki Connection Failed
WARN: Loki unavailable: Invalid URLChecklist:
Verify Loki is running:
bashcurl http://localhost:3100/readyCheck
LOKI_URLenvironment variable:bashecho $LOKI_URL # Should be like http://loki-server:3100
Webhook Push Failed
Error: Webhook URL validation failed: URL must start with https://Or:
Error: Webhook URL validation failed: URL resolves to private IP rangeChecklist:
- Webhook URLs must use
https://(nothttp://). - URLs cannot resolve to private IP ranges (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16).
- Verify
FEISHU_WEBHOOK_URLorSLACK_WEBHOOK_URLenvironment variables.
File Analysis Issues
File not found
Error: File not found: /path/to/server.logSolution:
Verify the file exists:
bashls -la /path/to/server.logUse absolute paths to avoid ambiguity.
Ensure the path does not contain
../(path traversal is blocked for security).
Empty analysis results
If analyze_log returns zero events:
- Check that log format matches expected patterns (text or JSON Kafka logs).
- Verify the log file contains Kafka-related entries.
- Try with
--debugflag for detailed parsing information:bashnpx kafka-log-analyze analyze server.log --debug
Path traversal error
Error: Invalid path: path traversal detectedSolution: Use direct paths without ../ sequences. The analyzer blocks path traversal for security.
Storage Issues
SQLite database error
Error: DATABASE_ERROR: unable to open database fileChecklist:
Check
SQLITE_PATHenvironment variable:bashecho $SQLITE_PATH # Default: ./storage/kafka-analyzer.dbEnsure the storage directory is writable:
bashmkdir -p ./storage chmod 755 ./storageIf persistence is not needed, the analyzer continues to work without storage.
Hook Server Issues
Port already in use
Error: HOOK_ERROR: listen EADDRINUSE: address already in use :::3000Solution: Use a different port:
npx kafka-log-analyze hooks --port 3001Or set PAGERDUTY_WEBHOOK_PORT environment variable.
Hook not triggering analysis
Verify the hook server is running:
bashcurl http://localhost:3000/hooks/healthCheck webhook payloads match expected format (Grafana unified alerting or PagerDuty Events API v2).
Review dedup settings — alerts within the TTL window are suppressed:
HOOK_DEDUP_WINDOW_MS=30000 # 30 seconds default