Troubleshooting & Help ‐ Common procedures ‐ Reduce database size - MarechJ/hll_rcon_tool GitHub Wiki

🧭 You are here : Wiki home / Troubleshooting & Help / Common procedures / Reduce database size


Every log line the game server has ever sent to CRCON is definitely stored in the database.

That could represent hundreds of thousands lines if you're using CRCON since some time.

A "normal" 100 slots game server that runs with 95+ players during ~12 hours a day generates about 40,000 lines of logs each day. That's 14.6 millions lines a year.

These lines are "text only", thus they don't individually weight much, but as they are numerous,
your database size may have grown up to dozens of GBs after some monthes.

If you want to know how much space the database occupies on your host storage, you can enter this command :

du -sh /root/hll_rcon_tool/db_data/

As you want to regain some storage on your host, you may want to reduce your database size.
Thus, deleting the log lines is the most effective way to do so, as old log lines aren't needed for CRCON to work,
and are the most storage-hungry ones in database.

[!TIP] Managing a huge database doesn't really impact CRCON's performance.
So : don't hope deleting log lines will fix any eventual lagginess or slowdowns in CRCON's operations.
If your CRCON is slow, you should first observe the CPU/RAM/network usage on your VPS.

[!WARNING] CRCON doesn't need old log lines to work, so deleting them won't affect it in any way.
Still, we'll never be sure something won't go wrong during the delete operation.
So you'll be advised to always have a fresh backup of a known-to-be-working CRCON install.

[!CAUTION] This procedure will DELETE the log lines stored in CRCON's database.

  • You won't be able to get them back (unless you restore a backup version of the whole database).
  • If you're using Game Logs to retrace a player's timeline, you won't find them anymore.
  • You'll still be able to view his stats and sessions details in Games,
    or any message or admin action he received on his profile, though.

0. Enter an SSH session on your VPS

See this guide to get into a SSH terminal prompt.

[!NOTE] We'll assume you have installed CRCON in its default /root/hll_rcon_tool folder, following the installation guide.
Adapt the commands given below if necessary.

1. Delete log lines

Example 1 : delete every log line that is older than 24h.

cd /root/hll_rcon_tool
docker compose exec -it postgres psql -U rcon -c 'DELETE FROM public.log_lines WHERE event_time < CURRENT_DATE-1;'
docker compose exec -it postgres psql -U rcon -c 'VACUUM ANALYZE public.log_lines;'

Example 2 : delete ALL log lines.

cd /root/hll_rcon_tool
docker compose exec -it postgres psql -U rcon -c 'DELETE FROM public.log_lines;'
docker compose exec -it postgres psql -U rcon -c 'VACUUM ANALYZE public.log_lines;'

Now look at your database size again : it should have considerably dropped.