stats
The stats command group provides comprehensive analytics by parsing the audit log, showing blocking patterns, effectiveness scores, and domain-level statistics.
nextdns-blocker stats [OPTIONS]nextdns-blocker stats SUBCOMMAND [ARGS]Options
Section titled “Options”| Option | Default | Description |
|---|---|---|
--days N | 7 | Number of days to analyze |
--domain NAME | - | Filter statistics by domain |
Subcommands
Section titled “Subcommands”| Subcommand | Description |
|---|---|
| (none) | Show summary statistics |
domains | Show top blocked domains with details |
hours | Show detailed hourly activity patterns |
actions | Show breakdown of all action types |
export | Export statistics to CSV file |
Summary View (Default)
Section titled “Summary View (Default)”nextdns-blocker statsOutput:
NextDNS Blocker Statistics (last 7 days)
Summary Total entries: 2178 Unique domains: 45 Date range: 2024-01-08 to 2024-01-15
Actions Blocks: 245 Unblocks: 42 Allows: 18 Disallows: 5 Pauses: 12 Resumes: 12 Panic activations: 3
Effectiveness Score: 83% (blocks maintained / total blocks)
Top Blocked Domains 1. reddit.com ████████████ 89 2. twitter.com ████████ 52 3. youtube.com ██████ 38 4. instagram.com █████ 31 5. tiktok.com ████ 25
Activity by Hour 00-06: ████ (low) 06-12: ██████ (medium) 12-18: ████████ (high) 18-24: ██████████ (peak)With Date Filter
Section titled “With Date Filter”nextdns-blocker stats --days 30With Domain Filter
Section titled “With Domain Filter”nextdns-blocker stats --domain reddit.comOutput:
Statistics for reddit.com (last 7 days)
Activity Blocks: 89 Unblocks: 12 Allows: 0 Disallows: 0
Pending Actions Created: 5 Cancelled: 3 Executed: 2
Last blocked: 2024-01-15 10:30 Last unblocked: 2024-01-14 19:45
Effectiveness Score: 87%stats domains
Section titled “stats domains”Show top blocked domains with detailed statistics.
nextdns-blocker stats domains [--limit N]Options
Section titled “Options”| Option | Default | Description |
|---|---|---|
--limit N | 10 | Number of domains to show |
Example
Section titled “Example”nextdns-blocker stats domains --limit 20Output:
Top 20 Blocked Domains (last 7 days)
# Domain Blocks Unblocks Effectiveness────────────────────────────────────────────────────────1 reddit.com 89 12 87%2 twitter.com 52 8 85%3 youtube.com 38 15 61%4 instagram.com 31 2 94%5 tiktok.com 25 0 100%...stats hours
Section titled “stats hours”Show detailed hourly activity patterns.
nextdns-blocker stats hoursOutput:
Hourly Activity (last 7 days)
00:00 ██ B:2 U:001:00 █ B:1 U:002:00 B:0 U:0...09:00 ████████ B:15 U:310:00 ██████████████ B:28 U:5...22:00 ████████████████████████ B:45 U:823:00 ██████████████ B:25 U:2stats actions
Section titled “stats actions”Show breakdown of all action types.
nextdns-blocker stats actionsOutput:
Action Breakdown (last 7 days)
Action Count────────────────────────────────BLOCK 245 ████████████████████SYNC 1847 ██████████████████████████████UNBLOCK 42 ████ALLOW 18 ██PANIC_ACTIVATE 3PENDING_CREATE 8 █PENDING_CANCEL 3PENDING_EXECUTE 5
Total entries: 2195stats export
Section titled “stats export”Export statistics to CSV format for external analysis.
nextdns-blocker stats export -o FILEOptions
Section titled “Options”| Option | Required | Description |
|---|---|---|
-o, --output FILE | Yes | Output CSV file path |
Example
Section titled “Example”nextdns-blocker stats export -o ~/stats.csvnextdns-blocker stats --days 30 export -o monthly.csvCSV format:
timestamp,action,domain,prefix2024-01-15T10:30:00,BLOCK,reddit.com,2024-01-15T10:35:00,WD,RESTORE,2024-01-15T11:00:00,UNBLOCK,reddit.com,Effectiveness Score
Section titled “Effectiveness Score”The effectiveness score measures how well blocking is maintained:
Score = (blocks - unblocks) / blocks * 100| Score | Interpretation |
|---|---|
| 90-100% | Excellent - Very few bypasses |
| 70-89% | Good - Some bypasses but mostly effective |
| 50-69% | Fair - Consider adjusting schedules |
| <50% | Poor - Blocking may be too restrictive |
Action Types
Section titled “Action Types”| Action | Description |
|---|---|
BLOCK | Domain was added to denylist |
UNBLOCK | Domain was removed from denylist |
ALLOW | Domain was added to allowlist |
DISALLOW | Domain was removed from allowlist |
PANIC_ACTIVATE | Panic mode was activated |
PENDING_CREATE | Pending action was created |
PENDING_CANCEL | Pending action was cancelled |
PENDING_EXECUTE | Pending action was executed |
PC_ACTIVATE | Parental Control category/service activated |
Audit Log Location
Section titled “Audit Log Location”Statistics are derived from the audit log at:
- macOS/Linux:
~/.local/share/nextdns-blocker/logs/audit.log - Windows:
%LOCALAPPDATA%\nextdns-blocker\logs\audit.log
Audit Log Format
Section titled “Audit Log Format”Each line in the audit log follows this format:
2024-01-15T14:30:00 | ACTION | detailsFor watchdog entries:
2024-01-15T14:30:00 | WD | ACTION | detailsNo Audit Log
Section titled “No Audit Log”If no audit log exists:
nextdns-blocker statsOutput:
No activity recorded in the last 7 daysThis happens when:
- Fresh installation (no actions yet)
- Audit log was deleted
- Data directory doesn’t exist
Privacy
Section titled “Privacy”The audit log contains:
- Timestamps of actions
- Action types
- Domain names (for block/unblock)
It does NOT contain:
- Browsing history
- DNS queries
- Personal information
Clearing Statistics
Section titled “Clearing Statistics”To reset statistics, delete the audit log:
rm ~/.local/share/nextdns-blocker/logs/audit.logOr uninstall and reinstall:
nextdns-blocker uninstallnextdns-blocker initScripting
Section titled “Scripting”Use JSON output for automation:
# Export to CSV and processnextdns-blocker stats export -o /tmp/stats.csvcat /tmp/stats.csv | wc -lRelated
Section titled “Related”- Log Files Reference - Audit log details
- health - System health checks