User Tools

Site Tools


blog:release_space_from_fail2ban_sqlite3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

blog:release_space_from_fail2ban_sqlite3 [2022-06-29 09:56] – created brbblog:release_space_from_fail2ban_sqlite3 [2022-06-29 10:02] (current) brb
Line 9: Line 9:
  
 Open the db: Open the db:
-sqlite3 /var/lib/fail2ban/fail2ban.sqlite3+  sqlite3 /var/lib/fail2ban/fail2ban.sqlite3
  
 Now, check all the tables available: Now, check all the tables available:
-sqlite> .tables +  sqlite> .tables 
-bans fail2banDb jails logs+  bans fail2banDb jails logs
  
 Generally, the “bans” table is the one that uses more space. You can check the content of this table using some SELECT statements like: Generally, the “bans” table is the one that uses more space. You can check the content of this table using some SELECT statements like:
-sqlite> SELECT * FROM bans limit 1;+  sqlite> SELECT * FROM bans limit 1;
 With this, you can check one single row, and all its parts and content. With this, you can check one single row, and all its parts and content.
  
 If you identify, for example, that there are very old entries (in my case, entries from 2 years ago, from 2018 and 219), you can trim all those entries with this command: If you identify, for example, that there are very old entries (in my case, entries from 2 years ago, from 2018 and 219), you can trim all those entries with this command:
-sqlite> DELETE FROM bans WHERE DATE(timeofban, 'unixepoch') < '2020-01-01'; VACUUM;+  sqlite> DELETE FROM bans WHERE DATE(timeofban, 'unixepoch') < '2020-01-01'; VACUUM;
  
 After running the above command, I got my db shrank. After running the above command, I got my db shrank.
blog/release_space_from_fail2ban_sqlite3.1656489368.txt.gz · Last modified: 2022-06-29 09:56 by brb