YunoHost-Apps / gotosocial_ynh

GoToSocial package for YunoHost: an ActivityPub social network server, written in Golang.
https://gotosocial.org
Other
10 stars 5 forks source link

BIG logfile #110

Closed xmgz closed 9 months ago

xmgz commented 9 months ago

TL;DR

gts log file is almost 1Gb in size, is this normal? Can it be mitigated manually setting more restrictive values in the config? does it need to be that big? Thank you.

I've not edited or changed default settings neither for gts nor yunohost

Issue

as I have very small VPS (debian 11, x64, ynh 11.2.5, gts 0.12.1) so I check space available from time to time and I noticed what I consider a very big logfile for gotosocial, and is also true compared to other services:

root@SERVER:~#du -h -d 1 /var/log/
4.0K    /var/log/chrony
361M    /var/log/journal              <-------------------- 361M 
4.0K    /var/log/sysstat
12K     /var/log/runit
76K     /var/log/apt
39M     /var/log/yunohost
4.0K    /var/log/ntpstats
12M     /var/log/nginx
6.9M    /var/log/postgresql
932M    /var/log/gotosocial__2           <----------------------   932M
4.0K    /var/log/private
364K    /var/log/gemserv
4.0K    /var/log/mysql
900K    /var/log/borg
164K    /var/log/rspamd
32K     /var/log/redis
44K     /var/log/unattended-upgrades
212K    /var/log/metronome
1.4G    /var/log/           <------------------   TOTAL SIZE

gotosocial__2 is about 2/3 of total size :/ That catched my eye.

Reading gotosocial's logrotate config:

root@SERVER:~#cat /etc/logrotate.d/gotosocial__2 
/var/log/gotosocial__2/*.log {
        # Rotate if the logfile exceeds 100Mo
    size 100M       <--------   **this setting DOES NOT apply  (932 > 100), but as there's only one file I guess it is not "rotated"**
        # Keep 12 old log maximum
    rotate 12
        # Compress the logs with gzip
    compress
        # Compress the log at the next cycle. So keep always 2 non compressed logs
    delaycompress
        # Copy and truncate the log to allow to continue write on it. Instead of move the log.
    copytruncate
        # Do not do an error if the log is missing
    missingok
        # Not rotate if the log is empty
    notifempty
        # Keep old logs in the same dir
    noolddir

}
root@SERVER:~#ls -la /var/log/gotosocial__2/
total 953444
drwxrwxrwx  2 root root      4096 Sep  3 05:27 .
drwxr-xr-x 20 root root      4096 Nov  1 00:00 ..
-rw-r--r--  1 root root 976312927 Nov  1 17:06 gotosocial__2.log        <------- **one single log file** 

in /var/www/gotosocial__2/config.yaml we have log-level: "info", would this log level cause such a big file?

So, any thoughts would be appreciated, thank you.

OniriCorpe commented 9 months ago

Hi!

Its a bug with how YunoHost generates logrotate config files I opened an issue here some time ago: https://github.com/YunoHost/issues/issues/2242 It's a "core" bug, not a package bug, so I'll not fix it in the GTS package

For now you can fix this using those two commands: chmod 644 /etc/logrotate.d/gotosocial__2 logrotate -v /etc/logrotate.d/gotosocial__2

The first one fixes the wrong permissions while the second one processes the log file to rotate it immediately

In fact only the first one is needed, as your system should rotates the log automatically in the future

xmgz commented 9 months ago

oh! thank you.

OniriCorpe commented 9 months ago

@xmgz the patch is now released in the yunohost 11.2.6 :)