User Tools

Site Tools


start

This blog is my notebook for computer and technology related information, copies of useful webcontent (with refs of course), troubleshooting, general tips and setups that work well for me.

Useful tags:

Blog

Release space from fail2ban sqlite3

Reduce fail2ban.sqlite3 file

You might face an increase of the file /var/lib/fail2ban/fail2ban.sqlite3

Here few commands that allows you to dig within the db, and clean up some rows, reducing its size.

Open the db:

sqlite3 /var/lib/fail2ban/fail2ban.sqlite3

Now, check all the tables available:

sqlite> .tables
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:

sqlite> SELECT * FROM bans limit 1;

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:

sqlite> DELETE FROM bans WHERE DATE(timeofban, 'unixepoch') < '2020-01-01'; VACUUM;

After running the above command, I got my db shrank. A restart of fail2ban services will reload the db and release the space of the previous db.

Ref: https://blog.tian.it/reduce-fail2ban-sqlite3-file/

2022-06-29 09:56 · brb · 0 Comments

Archive

Blog History

2009-05: 18 entries 2009-06: 12 entries 2009-07: 9 entries 2009-08: 5 entries 2009-09: 2 entries 2009-10: 2 entries 2009-11: 5 entries 2009-12: 4 entries 2010-01: 1 entry 2010-02: 3 entries 2010-03: 2 entries 2010-04: 2 entries 2010-05: 3 entries 2010-06: 10 entries 2010-07: 8 entries 2010-08: 5 entries 2010-09: 4 entries 2010-10: 6 entries 2010-11: 2 entries 2010-12: 6 entries 2011-01: 5 entries 2011-02: 3 entries 2011-03: 5 entries 2011-04: 2 entries 2011-05: 4 entries 2011-06: 5 entries 2011-07: 11 entries 2011-08: 12 entries 2011-09: 4 entries 2011-10: 4 entries 2011-11: 2 entries 2011-12: 1 entry 2012-01: 5 entries 2012-02: 2 entries 2012-04: 3 entries 2012-06: 1 entry 2012-09: 4 entries 2012-10: 1 entry 2013-04: 1 entry 2014-04: 10 entries 2014-08: 2 entries 2015-04: 1 entry 2015-09: 3 entries 2016-04: 1 entry 2016-05: 1 entry 2016-06: 1 entry 2016-07: 2 entries 2016-10: 1 entry 2017-01: 1 entry 2017-02: 2 entries 2017-04: 1 entry 2017-05: 1 entry 2017-07: 2 entries 2017-08: 1 entry 2017-10: 1 entry 2017-11: 1 entry 2017-12: 2 entries 2018-10: 1 entry 2019-02: 1 entry 2019-05: 1 entry 2019-09: 1 entry 2019-10: 2 entries 2020-08: 1 entry 2020-01: 1 entry 2021-01: 1 entry 2021-02: 1 entry 2021-07: 1 entry 2022-05: 2 entries 2022-06: 1 entry 2022-11: 1 entry 2023-05: 1 entry 2023-09: 2 entries 2023-12: 2 entries 2024-09: 1 entry

2024

September

2023

December

September

May

2022

November

June

May

2021

July

February

January

2020

January

August

2019

October

September

May

February

2018

October

2017

December

November

October

August

July

May

April

February

January

2016

October

July

June

May

April

2015

September

April

2014

August

April

2013

April

2012

October

September

June

April

February

January

2011

December

November

October

September

August

July

June

May

April

March

February

January

2010

December

November

October

September

August

July

June

May

April

March

February

January

2009

December

November

October

September

August

July

June

May

start.txt · Last modified: 2022-11-29 08:28 by brb