Fail2ban log shows only recent entries

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=10
    G_DIETPI_VERSION_RC=0
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    G_LIVE_PATCH_STATUS[0]=‘applied’
    G_LIVE_PATCH_STATUS[1]=‘not applicable’
    G_LIVE_PATCH_STATUS[2]=‘not applicable’
    G_LIVE_PATCH_STATUS[3]=‘not applied’

  • Distro version
    bullseye 0

  • Kernel version
    Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

  • Architecture
    arm64

  • SBC model
    RPi 4 Model B (aarch64)

  • Power supply used
    Raspberry Pi 4 USB-C 5.1V 3A 15W official power supply

  • SD card used
    SanDisk

Hi everyone!
My fail2ban log only shows entries of the last few hours. Sometimes it’s empty (I suspect only if nothing happend in the last hours).
I have no idea who is clearing the log. I was suspecting logrotate but I don’t see any old (rotated) logs.
I would like to understand the reason and have logs of the last days or even weeks.

Here are some infos that might help.

Logfile: /var/log/fail2ban.log (Usually only shows entries of the last few hours or so)

sudo cat /etc/fail2ban/fail2ban.d/97_dietpi.conf
[Definition]
logtarget = /var/log/fail2ban.log


sudo cat /etc/logrotate.d/fail2ban
/var/log/fail2ban.log {

    rotate 5
    size 10M
    # Do not rotate if empty
    notifempty
    missingok
    postrotate
        fail2ban-client flushlogs 1>/dev/null
    endscript

}
ls /var/log/ -lh
total 12K
-rw-r--r-- 1 root     root        0 May 13 14:17 alternatives.log
drwxr-xr-x 2 root     root      100 May 13 14:16 apt
-rw-rw---- 1 root     utmp        0 May 20 10:17 btmp
-rw-r--r-- 1 root     root        0 May 13 14:16 dpkg.log
-rw-r----- 1 root     adm        90 May 20 12:22 fail2ban.log
-rw-rw-r-- 1 root     utmp     290K May 20 12:21 lastlog
drwxr-x--- 2 www-data www-data   60 Dec 22  2021 lighttpd
-rw------- 1 root     root        0 May 13 14:17 php7.4-fpm.log
drwxr-xr-x 2 pihole   pihole    160 May 20 00:17 pihole
lrwxrwxrwx 1 pihole   pihole     23 Oct 16  2022 pihole-FTL.log -> /var/log/pihole/FTL.log
lrwxrwxrwx 1 pihole   pihole     26 Oct 16  2022 pihole.log -> /var/log/pihole/pihole.log
drwx------ 2 root     root       40 Dec 15  2021 private
drwxr-xr-x 3 root     root       60 Oct 13  2022 runit
-rw-rw-r-- 1 root     utmp      400 May 20 12:21 wtmp

by default logs are clreared on hourly basis. Can you check your corrent logging setting Log System Choices - DietPi.com Docs

Thank you! I was not aware of the RAMlog system. I switched to mode #2 for now. Thanks again!