2024-09-28, 11:47 PM
(This post was last modified: 2024-09-28, 11:53 PM by TheDreadPirate. Edited 3 times in total.)
Remove the port and protocol lines. They aren't necessary for jails that read logs.
Also, I think the fail2ban docs need to be updated. Jellyfin USED to write the current day's logs to jellyfin.log, but now it is log_YYYYMMDD.log.
I recall working through this earlier this year. I ended up setting up a cronjob that runs at midnight that creates a symlink called jellyfin.log that symlinks to the log for the current day.
My cronjob runs this script at a minute past midnight.
Root's crontab.
Also, I think the fail2ban docs need to be updated. Jellyfin USED to write the current day's logs to jellyfin.log, but now it is log_YYYYMMDD.log.
I recall working through this earlier this year. I ended up setting up a cronjob that runs at midnight that creates a symlink called jellyfin.log that symlinks to the log for the current day.
Code:
chris@rat-trap:/var/log/jellyfin$ cat /etc/fail2ban/jail.d/jellyfin.local
[jellyfin]
backend = auto
enabled = true
filter = jellyfin
maxretry = 5
bantime = 86400
findtime = 43200
logpath = /var/log/jellyfin/jellyfin.log
banaction = iptables-allports
[jellyfin-testing]
backend = auto
enabled = true
filter = jellyfin
maxretry = 5
bantime = 86400
findtime = 43200
logpath = /docker/containers/jellyfin-stable-data/config/log/jellyfin.log
banaction = iptables-allports
Code:
chris@rat-trap:/var/log/jellyfin$ ls -lrt
total 7160
lrwxrwxrwx 1 root root 34 Sep 28 00:01 jellyfin.log -> /var/log/jellyfin/log_20240928.log
-rw-r--r-- 1 jellyfin jellyfin 826505 Sep 28 19:46 log_20240928.log
Code:
chris@rat-trap:/docker/containers/jellyfin-stable-data/config/log$ ll
total 1608
lrwxrwxrwx 1 root root 67 Sep 28 00:01 jellyfin.log -> /docker/containers/jellyfin-stable-data/config/log/log_20240928.log
-rw-r--r-- 1 jellyfin jellyfin 413124 Sep 28 18:46 log_20240928.log
My cronjob runs this script at a minute past midnight.
Code:
#!/bin/bash
rm /var/log/jellyfin/jellyfin.log
NEWFILE=$(ls -lrt /var/log/jellyfin/* | egrep -v "FFmpeg|record|upload" | tail -1 | awk '{print $NF}')
ln -s $NEWFILE /var/log/jellyfin/jellyfin.log
rm /docker/containers/jellyfin-stable-data/config/log/jellyfin.log
NEWFILE=$(ls -lrt /docker/containers/jellyfin-stable-data/config/log/* | egrep -v "FFmpeg|record|upload" | tail -1 | awk '{print $NF}')
ln -s $NEWFILE /docker/containers/jellyfin-stable-data/config/log/jellyfin.log
Root's crontab.
Code:
# m h dom mon dow command
1 0 * * * rotateJellyfinLog