Connection Errors to Elasticsearch
Elasticsearch connectivity issues are common and can prevent SafeNetworking from processing events.Symptoms
- Application fails to start
- ERROR messages about connection timeouts or refused connections
- Events not being processed
Solutions
Verify Elasticsearch is Running
Verify Elasticsearch is Running
Check if Elasticsearch is running:Expected response:
Check Configuration
Check Configuration
Verify Elasticsearch connection settings in If Elasticsearch is on a different host or port, update these settings and restart SafeNetworking.
.panrc:Check Network Connectivity
Check Network Connectivity
Test network connectivity to Elasticsearch:If connection fails, check firewall rules or network configuration.
Review Elasticsearch Logs
Review Elasticsearch Logs
Check Elasticsearch logs for errors:Look for:
- Out of memory errors
- Disk space issues
- Configuration errors
Verify Index Health
Verify Index Health
Check Elasticsearch cluster and index health:If indices are red, you may have shard allocation issues or data corruption.
Prevention
AutoFocus API Issues
Problems with the AutoFocus API can prevent threat intelligence enrichment.Rate Limit Exceeded (Daily)
Symptoms:- Processing slows down or stops
- WARNING messages about point exhaustion
AF_POINTS_MODEactivated
Low Points Warning
When daily points drop below
AF_POINTS_LOW (default: 5000), processing switches to single-threaded mode to conserve points.Location: project/dns/dnsutils.py:90Processing Halt
When daily points drop below
AF_POINT_NOEXEC (default: 500), all processing stops.Location: project/dns/dnsutils.py:80Rate Limit Exceeded (Minute)
Symptoms:- Brief processing pauses
- “Minute Bucket Exceeded” messages
project/dns/dnsutils.py:98-100
Solution:
API Key Issues
Symptoms:- Application exits immediately on startup
- CRITICAL error about API key
Verify API Key
Test your API key using curl:You should receive a JSON response with tag information.
Query Timeouts
Symptoms:- Queries to AutoFocus take too long
- Processing is slow
- Partial results returned
project/dns/dnsutils.py:426-438
Configuration:
How it works:
- SafeNetworking submits a query and receives a “cookie”
- Every minute, it checks query completion percentage
- If
AF_LOOKUP_TIMEOUTexpires OR completion ≥AF_LOOKUP_MAX_PERCENTAGE, results are accepted - Increasing timeout improves result quality but slows processing
| Scenario | AF_LOOKUP_TIMEOUT | AF_LOOKUP_MAX_PERCENTAGE |
|---|---|---|
| Fast processing, acceptable accuracy | 1 | 15 |
| Balanced (default) | 2 | 20 |
| High accuracy, slower processing | 3 | 40 |
| Maximum accuracy | 5 | 60 |
Processing Halts
SafeNetworking stops processing events without obvious errors.Symptoms
- No new events being processed
- No ERROR messages in logs
- SafeNetworking process is running
- Unprocessed events accumulating in Elasticsearch
Diagnostic Steps
Check AutoFocus Points
Query the af-details document:Check
daily_points_remaining. If below 500, processing is paused automatically.Solutions
Restart SafeNetworking
Restart SafeNetworking
Sometimes a simple restart resolves the issue:
Wait for AutoFocus Points Reset
Wait for AutoFocus Points Reset
If processing stopped due to point exhaustion (below 500), wait for the daily reset:
- AutoFocus points reset at midnight UTC
- Processing resumes automatically when points refresh
- Check current time vs. reset time
Check Thread Health
Check Thread Health
Background threads may have crashed. Check for thread-related errors:If threads crashed, restart SafeNetworking.
Verify Elasticsearch Connectivity
Verify Elasticsearch Connectivity
Processing can stall if Elasticsearch connectivity is intermittent:Resolve any Elasticsearch issues found.
Recovery Procedure
Debug Mode Configuration
Enable debug mode for detailed troubleshooting information.Enable Debug Mode
Edit.panrc:
What Debug Mode Does
- Normal Mode
- Debug Mode
- Processes multiple events in parallel using thread pools
- Pool size determined by
DNS_POOL_COUNT - Logs are concise (INFO level)
- High throughput
Debug Mode Output
With debug mode enabled, you’ll see detailed logs like:Disable Debug Mode
After troubleshooting, disable debug mode for normal performance:Check System Health
Comprehensive system health check procedure.Quick Health Check Script
health_check.sh, make executable, and run:
Component Status Checklist
System Requirements
System Requirements
Operating System:
- Linux distribution (Ubuntu, CentOS, RHEL)
- Adequate CPU (multi-core recommended)
- Sufficient RAM (4GB+ recommended)
- Disk space for logs and Elasticsearch data
SafeNetworking Application
SafeNetworking Application
- Process running
- Flask server responding on configured port
- Background threads active (DNS, IoT, AF points)
- No CRITICAL or ERROR messages in recent logs
- Configuration file (.panrc) present and valid
Elasticsearch
Elasticsearch
- Elasticsearch service running
- Cluster status green or yellow
- All required indices present
- No red or unallocated shards
- Adequate disk space
AutoFocus API
AutoFocus API
- API key configured in .panrc
- Daily points remaining > 500
- Minute points not consistently exceeded
- Queries returning results
- Reasonable response times
Event Processing
Event Processing
- Events being retrieved from Elasticsearch
- Domain lookups succeeding
- Tags being assessed and applied
- Events marked as processed (SFN.processed = 1)
- Reasonable processing rate
Common Error Messages
Quick Reference
| Error Message | Severity | Likely Cause | Solution |
|---|---|---|---|
API Key for Autofocus is not set | CRITICAL | Missing API key | Add AUTOFOCUS_API_KEY to .panrc |
Connection refused | ERROR | Elasticsearch down | Start Elasticsearch service |
Connection timeout | ERROR | Network/ES slow | Check ES health and network |
Daily Bucket Exceeded | WARNING | AF points exhausted | Wait for reset or adjust thresholds |
Minute Bucket Exceeded | WARNING | Too many parallel requests | Reduce DNS_POOL_COUNT |
Unable to work with event doc | ERROR | ES or processing issue | Check ES connectivity and event structure |
Transport Error | ERROR | ES communication failure | Restart ES or check network |
No local cache found | INFO | Normal, creating cache | No action needed |
No samples found for domain | INFO | AF query returned no results | Normal for some domains |
Slowing down execution | INFO | Low AF points | Normal protection, wait for reset |
Getting Additional Help
Enable Debug Logging
Set
LOG_LEVEL = "DEBUG" in .panrc and review detailed logs for more context about errors.Check Documentation
Review the monitoring guide for normal operational indicators and metrics to compare against.
Elasticsearch Documentation
Consult Elasticsearch documentation for cluster and index management issues.
AutoFocus Support
Contact Palo Alto Networks support for AutoFocus API issues or rate limit increases.
Next Steps
Monitoring
Set up monitoring to catch issues before they impact operations
Running SafeNetworking
Review configuration options to optimize performance
