# Fail2ban monitoring empty files

**URL:** <https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284>\
**Category:** Support\
**Tags:** raspberrypi, fail2ban, english\
**Created:** [May 17, 2026, 3:31pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284 "2026-05-17T15:31:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 3:31pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/1 "2026-05-17T15:31:21Z")

</div>

**What type of hardware are you using** : Raspberry Pi 3, 4+  
**What YunoHost version are you running** : 12.1.39  
**How are you able to access your server** : The webadmin  
SSH  
**Are you in a special context or did you perform specific tweaking on your YunoHost instance ?** : nothing special

### Describe your issue

Hi,  
my configuration is the following:  
yunohost:  
repo: stable  
version: 12.1.39  
yunohost-admin:  
repo: stable  
version: 12.1.14  
yunohost-portal:  
repo: stable  
version: 12.1.2  
moulinette:  
repo: stable  
version: 12.1.3  
ssowat:  
repo: stable  
version: 12.1.1

I want to personalise fail2ban and adding new rules. Searching for logs files location, I discover in /var/log/nginx/ that there are access.log, error.log etc… but there size is 0 and the files access.log.1, error.log.1 are gradually growing in size. Does my logrotate service running correctly?  
More, fail2ban monitores the empty files.  
How can I correct all that?

### Share relevant logs or error messages

sudo ls -al /var/log/nginx/  
total 24128  
drwxr-xr-x+ 2 root adm 4096 May 17 12:44 .  
drwxr-xr-x 17 root root 4096 May 17 00:00 ..  
-rw-r----- 1 www-data adm 0 May 10 00:00 access.log  
-rw-r----- 1 www-data adm 4011431 May 17 17:28 access.log.1  
-rw-r----- 1 www-data adm 1072011 May 9 18:17 access.log.2.gz  
-rw-r----- 1 www-data adm 517890 Mar 20 06:24 access.log.3.gz  
-rw-r----- 1 www-data adm 66655 Feb 17 20:14 access.log.4.gz  
-rw-r----- 1 www-data adm 0 May 10 00:00 error.log  
-rw-r----- 1 www-data adm 72205 May 17 14:27 error.log.1  
-rw-r----- 1 www-data adm 32258 May 9 18:10 error.log.2.gz  
-rw-r----- 1 www-data adm 20628 Mar 20 06:09 error.log.3.gz  
-rw-r----- 1 www-data adm 3467 Feb 17 20:10 error.log.4.gz

…

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 5:00pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/2 "2026-05-17T17:00:48Z")

</div>

Is your server always running, or is it shut down from time to time?

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 5:28pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/3 "2026-05-17T17:28:05Z")

</div>

Usually it is running all the time but I restart it a week ago for a kernel update (That’s a RPi at home).

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 5:37pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/4 "2026-05-17T17:37:13Z")

</div>

Can you run and share the output of `sudo logrotate -d /etc/logrotate.d/nginx` ?

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 6:03pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/5 "2026-05-17T18:03:49Z")

</div>

> sudo logrotate -d /etc/logrotate.d/nginx

```auto
warning: logrotate in debug mode does nothing except printing debug messages! Consider using verbose mode (-v) instead if this is not what you want.

reading config file /etc/logrotate.d/nginx
Reading state from file: /var/lib/logrotate/status
Allocating hash table for state file, size 64 entries
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state
Creating new state

Handling 1 logs

rotating pattern: /var/log/nginx/*.log after 1 days (14 rotations)

```

`empty log files are not rotated, old logs are removed`  
`considering log /var/log/nginx/access.log`  
`Now: 2026-05-17 20:01`  
`Last rotated at 2026-05-10 00:00`  
`log does not need rotating (log is empty)`  
`considering log /var/log/nginx/error.log`  
`Now: 2026-05-17 20:01`  
`Last rotated at 2026-05-10 00:00`  
`log does not need rotating (log is empty)`  
`...`  
`not running prerotate script, since no logs will be rotated`  
`not running postrotate script, since no logs were rotated`

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 6:35pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/6 "2026-05-17T18:35:12Z")

</div>

half an hour later, we can see that the access.log.1 file is growing:

`-rw-r----- 1 www-data adm 0 May 10 00:00 access.log`  
`-rw-r----- 1 www-data adm 4030979 May 17 20:22 access.log.1`  
`-rw-r----- 1 www-data adm 1072011 May 9 18:17 access.log.2.gz`  
`-rw-r----- 1 www-data adm 517890 Mar 20 06:24 access.log.3.gz`  
`-rw-r----- 1 www-data adm 66655 Feb 17 20:14 access.log.4.gz`

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 6:44pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/7 "2026-05-17T18:44:30Z")

</div>

Can you try `sudo invoke-rc.d nginx rotate` ?

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 7:01pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/8 "2026-05-17T19:01:59Z")

</div>

> [@otm33](#):
>
> sudo invoke-rc.d nginx rotate

Here is the result:

`sudo invoke-rc.d nginx rotate`  
`invoke-rc.d: policy-rc.d denied execution of rotate.`

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 7:03pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/9 "2026-05-17T19:03:08Z")

</div>

Thanks for your help @otm33 !

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 7:16pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/10 "2026-05-17T19:16:33Z")

</div>

Solved ?

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 7:17pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/11 "2026-05-17T19:17:45Z")

</div>

No unfortunately

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 7:20pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/12 "2026-05-17T19:20:21Z")

</div>

> [@marco](#):
>
> policy-rc.d denied execution of rotate

Can you share `sudo cat /usr/sbin/policy-rc.d`?

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 7:23pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/13 "2026-05-17T19:23:10Z")

</div>

sudo cat /usr/sbin/policy-rc.d

`#!/bin/bash`  
`[[“$1” =~ “nginx”]] && exit 101 || exit 0`

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 7:28pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/14 "2026-05-17T19:28:50Z")

</div>

This issue seems related to amigration from bookworm.  
Can you try first this and share the output ?  
`yunohost tools regen-conf nginx -h`

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 7:31pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/15 "2026-05-17T19:31:03Z")

</div>

> [@otm33](#):
>
> yunohost tools regen-conf nginx -h

sudo yunohost tools regen-conf nginx -h

```auto
usage: yunohost tools regen-conf [NAME …] [-h] [-d] [-f] [-n] [-p]

Regenerate the configuration file(s)

```

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 7:31pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/16 "2026-05-17T19:31:49Z")

</div>

sorry : sudo yunohost tools regen-conf nginx **-n**

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 7:35pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/17 "2026-05-17T19:35:27Z")

</div>

I remember last february, fail2ban was working correctly, it blocks a user one time.

I tried: sudo yunohost tools regen-conf nginx -n

[no output]

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 7:38pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/18 "2026-05-17T19:38:12Z")

</div>

No output ?  
So let’s try this

```auto
sudo nano /usr/sbin/policy-rc.d

```

Comment out the line

```auto
# #!/bin/bash
# [["$1" =~ "nginx"]] && exit 101 || exit 0

```

and retry

```auto
sudo invoke-rc.d nginx rotate

```

---

<div class="post-metadata">

**Author:** ![marco](https://forum.yunohost.org/user_avatar/forum.yunohost.org/marco/32/2661_2.png) [@marco](https://forum.yunohost.org/u/marco)\
**Post date:** [May 17, 2026, 7:44pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/19 "2026-05-17T19:44:52Z")

</div>

I comment, and then:

sudo invoke-rc.d nginx rotate  
`Re-opening nginx log files: nginx.`

The result seems very good!

sudo lsof /var/log/nginx/access.log  
`COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME`  
`nginx 1201 root 3w REG 8,2 0 126792 /var/log/nginx/access.log`  
`nginx 1202 www-data 3w REG 8,2 0 126792 /var/log/nginx/access.log`  
`nginx 1203 www-data 3w REG 8,2 0 126792 /var/log/nginx/access.log`  
`nginx 1204 www-data 3w REG 8,2 0 126792 /var/log/nginx/access.log`  
`nginx 1205 www-data 3w REG 8,2 0 126792 /var/log/nginx/access.log`

sudo lsof /var/log/nginx/access.log.1

[no output]

---

<div class="post-metadata">

**Author:** ![otm33](https://forum.yunohost.org/user_avatar/forum.yunohost.org/otm33/32/11941_2.png) [@otm33](https://forum.yunohost.org/u/otm33)\
**Post date:** [May 17, 2026, 7:46pm UTC](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284/20 "2026-05-17T19:46:04Z")

</div>

> [@marco](#):
>
> sudo invoke-rc.d nginx rotate  
> `Re-opening nginx log files: nginx.`

👍 !

[Next page](https://forum.yunohost.org/t/fail2ban-monitoring-empty-files/42284.md?page=2)
