Log Files
SafeNetworking writes all application logs to a rotating log file with detailed formatting for troubleshooting and monitoring.Log File Location
project directory).
Log files are automatically rotated when they reach the configured size limit to prevent disk space issues.
Log Configuration
Log behavior is configured in.panrc or uses defaults from project/__init__.py:140-157:
Log Format
SafeNetworking uses a custom log formatter defined inproject/__init__.py:11-32:
- Level: Severity of the message
- Timestamp: When the event occurred
- Module: Python module that logged the message
- Function: Function that logged the message
- Line: Line number in the source code
- Thread: Thread ID for multi-threaded operations
- Message: Descriptive log message
Log Levels
DEBUG
DEBUG
Detailed diagnostic information for troubleshooting. Shows every processing step, API calls, and data transformations. Use for development and debugging issues.Example messages:
Processing new DNS eventsCalling getDomainDoc() for example.comAF query returned {data}
INFO
INFO
Confirmation that things are working as expected. Shows major operational milestones without excessive detail. Recommended for production.Example messages:
SafeNetworking application initializing with log level of INFOBackground processes initializedSuccessfully updated IoT DB
WARNING
WARNING
Indicates something unexpected happened, but the application continues to work. Requires attention but not immediate action.Example messages:
We have exceeded the daily allotment of points for AutoFocus - going into hibernation modeSlowing down execution because daily point total is 4500
ERROR
ERROR
A serious problem occurred that prevented a specific operation from completing. Individual events or requests may fail.Example messages:
Unable to work with event doc abc123 - Connection timeoutTransport Error working with event456: Connection refusedUnable to retrieve domain info from AutoFocus
CRITICAL
CRITICAL
A very serious error that may cause the application to stop. Immediate action required.Example messages:
API Key for Autofocus is not set in .panrc, exitingApplication may not run correctly with proc count of 24 - you have been warned
Changing Log Level
Edit.panrc to change the log level:
What to Monitor
AutoFocus Points Usage
Monitor AutoFocus API point consumption to prevent processing slowdowns or halts. Key metrics:- Daily points remaining
- Minute points remaining
- Point consumption rate
sfn-detailsDocument ID:
af-details
Monitor these fields:
Event Processing
Monitor the rate and success of DNS event processing. Key metrics:- Number of events processed per cycle
- Processing success rate
- Queue depth (unprocessed events)
threat-*: DNS threat events being processedsfn-domain-details: Cached domain threat intelligencesfn-tag-details: Cached AutoFocus tag information
IoT Database Updates
Monitor IoT honeypot data synchronization (if enabled). Key metrics:- Last successful update timestamp
- Number of new IoT threats added
- External API availability
sfn-iot-details
Log indicators:
Elasticsearch Health
Monitor connectivity and health of the Elasticsearch cluster. Check cluster health:Status meanings:
- Green: All shards allocated, cluster healthy
- Yellow: All primary shards allocated, some replicas unallocated
- Red: Some primary shards unallocated, data loss possible
System Resource Usage
Monitor system resources to ensure adequate capacity. Key metrics:- CPU usage (multi-processing can be CPU-intensive)
- Memory usage (caching domains and tags)
- Disk space (log files, Elasticsearch indices)
- Network I/O (API calls to AutoFocus)
Key Metrics and Indicators
Healthy Operation
Indicators of healthy operation:
- Log level INFO shows regular processing cycles
- AutoFocus points remaining above 5,000
- Events processed successfully (“save: SUCCESS” messages)
- No ERROR or CRITICAL level messages in recent logs
- Elasticsearch cluster status is green or yellow
- Background threads running without exceptions
Warning Signs
- AutoFocus points below 5,000 (single-threaded mode active)
- Frequent “Connection timeout” errors
- Large number of unprocessed events accumulating
- Repeated “Unable to work with event” errors
- IoT database updates failing
- Disk space low on log partition or Elasticsearch data
Critical Issues
- AutoFocus API key not configured (CRITICAL log, application exits)
- AutoFocus points below 500 (processing stopped)
- Elasticsearch cluster status red
- SafeNetworking process not running
- Continuous ERROR messages in logs
- Elasticsearch connection refused
Kibana Dashboards
Visualize SafeNetworking operations and threat intelligence using Kibana dashboards.Accessing Kibana
KIBANA_HOST and KIBANA_PORT from .panrc.
Creating Index Patterns
Before creating dashboards, configure index patterns in Kibana:- Navigate to Management > Stack Management > Index Patterns
- Create index patterns for:
threat-*(DNS threat events)sfn-domain-details(Cached domain intelligence)sfn-tag-details(Cached tag information)sfn-iot-details(IoT honeypot data)sfn-details(AutoFocus points tracking)
Recommended Visualizations
AutoFocus Points
Gauge visualization showing daily points remaining
- Index:
sfn-details - Metric:
daily_points_remaining - Thresholds: Red < 500, Yellow < 5000, Green ≥ 5000
Event Processing Rate
Line chart showing events processed over time
- Index:
threat-* - Metric: Count of documents where
SFN.processed = 1 - Bucket: Date histogram on
SFN.updated_at
Malware Family Distribution
Pie chart showing top malware families detected
- Index:
threat-* - Bucket: Terms aggregation on
SFN.public_tag_name - Filter:
SFN.tag_class = "malware_family"
Threat Confidence Levels
Bar chart showing distribution of confidence levels
- Index:
threat-* - Bucket: Range aggregation on
SFN.confidence_level - Ranges: 0-20, 20-40, 40-60, 60-80, 80-100
Processing Errors
Data table showing failed event processing
- Index:
threat-* - Filter:
SFN.processed = 0AND@timestamp< now-1h - Columns:
@timestamp,SFN.domain_name,SFN.processed
IoT Threat Feed
Data table showing recent IoT threats
- Index:
sfn-iot-details - Columns:
ip,public_tag_name,tag_class,time - Sort:
timedescending
Sample Dashboard Query
Get processing statistics:Monitoring Best Practices
Configure Alerting
Set up alerts for critical thresholds:
- AutoFocus points below 5,000
- Elasticsearch cluster status not green
- Processing error rate above 5%
- SafeNetworking process not running
Monitor AutoFocus Usage
Track daily and minute point consumption to optimize processing configuration and avoid rate limits.
Next Steps
Troubleshooting
Resolve common issues and errors
Running SafeNetworking
Learn how to start and configure SafeNetworking
