I want to clear all of the logged history not just the past 24 hours. I think I read that the current version keeps more than just history in /etc/pihole/pihole-FTL.db
so I don't want to just delete that file. I looked at piholeLogFlush.sh
and I edited line 61 from
deleted=$(sqlite3 "${DBFILE}" "DELETE FROM queries WHERE timestamp >= strftime('%s','now')-86400; select changes() from queries limit 1")
To
deleted=$(sqlite3 "${DBFILE}" "DELETE FROM queries WHERE timestamp >= strftime('%s','now')-31536000; select changes() from queries limit 1")
So that should remove the past year of data. I ran it but my /etc/pihole/pihole-FTL.db
is still 114M.
Deleting the data will not free disk space. You would need a vacuum
as well.
SQL will just overwrite deleted space with new data.
For some background see
pi-hole:development
← TheGroundZero:patch-1
opened 02:48PM - 04 Aug 20 UTC
**By submitting this pull request, I confirm the following:**
*please fill any… appropriate checkboxes, e.g: [X]*
- [X] I have read and understood the [contributors guide](https://github.com/pi-hole/pi-hole/blob/master/CONTRIBUTING.md), as well as this entire template.
- [X] I have made only one major change in my proposed changes.
- [X] I have commented my proposed changes within the code.
- [X] I have tested my proposed changes, and have included unit tests where possible.
- [X] I am willing to help maintain this change if there are issues with it later.
- [X] I give this submission freely and claim no ownership.
- [X] It is compatible with the [EUPL 1.2 license](https://opensource.org/licenses/EUPL-1.1)
- [X] I have squashed any insignificant commits. ([`git rebase`](http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html))
Please make sure you [Sign Off](https://docs.pi-hole.net/guides/github/how-to-signoff/) all commits. Pi-hole enforces the [DCO](https://docs.pi-hole.net/guides/github/contributing/).
---
**What does this PR aim to accomplish?:**
*A detailed description, screenshots (if necessary), as well as links to any relevant GitHub issues*
Reduce disk space usage of the database file.
Note: this temporarily increases disk usage as VACUUM create a temp copy of the DB
**How does this PR accomplish the above?:**
*A detailed description (such as a changelog) and screenshots (if necessary) of the implemented fix*
Use SQLite's VACUUM command
**What documentation changes (if any) are needed to support this PR?:**
*A detailed list of any necessary changes*
One extra command to be executed
---
* You must follow the template instructions. Failure to do so will result in your pull request being closed.
* Please respect that Pi-hole is developed by volunteers, who can only reply in their spare time.
Thanks for the link. So take no action. If I really want to, I can vacuum it.
system
Closed
January 3, 2021, 1:02pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.