Skip to content

feat: add Invoke-PiHoleFlushLogs - #109

Merged
mikemadeja merged 3 commits into
developfrom
feature/invoke-pihole-flush-logs
Sep 25, 2026
Merged

mikemadeja merged 3 commits into
developfrom
feature/invoke-pihole-flush-logs

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

Implements POST /action/flush/logs, one of the two remaining "Actions" gaps from the API coverage audit. Flushes the DNS log file and purges the most recent 24 hours of query history from both the database and FTL's internal memory.

The other gap, POST /action/flush/arp, is deprecated by Pi-hole itself in favor of /action/flush/network (per the live API spec: "Deprecated! Use '/action/flush/network' instead."), which the module already implements via Invoke-PiHoleFlushNetwork - so it's intentionally not being added as a separate function. That leaves "Actions" fully covered.

Also fixed a copy-paste bug found along the way: Invoke-PiHoleFlushNetwork's .DESCRIPTION described flushing a log file, which is what this new function actually does, not what flushing the network table does.

Test plan

  • Invoke-ScriptAnalyzer -Path .\PiHoleShell -Recurse - clean
  • Verified against a real Pi-hole v6 server: formatted output, -RawOutput, and bad-password error handling
  • New integration test file, all 3 tests passing
  • Regenerated README.md

🤖 Generated with Claude Code

mikemadeja and others added 3 commits September 24, 2026 17:44
Implements POST /action/flush/logs, one of the two remaining "Actions" gaps
from the API coverage audit. Flushes the DNS log file and purges the most
recent 24 hours of query history from both the database and FTL's internal
memory.

The other gap, POST /action/flush/arp, is deprecated by Pi-hole itself in
favor of /action/flush/network ("Deprecated! Use '/action/flush/network'
instead."), which the module already implements via
Invoke-PiHoleFlushNetwork - so it's intentionally not being added as a
separate function.

Also fixed a copy-paste bug found along the way: Invoke-PiHoleFlushNetwork's
.DESCRIPTION described flushing a log file, which is what this new function
actually does, not what flushing the network table does.

Verified against a real Pi-hole v6 server: formatted output, RawOutput, and
bad-password error handling. Added a dedicated integration test file.
README regenerated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merges the latest develop (which reorganized tests/ to mirror
PiHoleShell/Public/<Category>/) into this branch, then moves this PR's own
new test file - added before that reorg landed - into tests/Actions/ to
match, fixing its $PSScriptRoot-relative IntegrationConfig.local.ps1
lookup accordingly. Verified against the real Pi-hole server post-move.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mikemadeja
mikemadeja merged commit 246d938 into develop Sep 25, 2026
3 checks passed
@mikemadeja mikemadeja mentioned this pull request Sep 25, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant