Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logrotate does not run daily #176

Open
leorg99 opened this issue Apr 25, 2021 · 1 comment
Open

logrotate does not run daily #176

leorg99 opened this issue Apr 25, 2021 · 1 comment

Comments

@leorg99
Copy link

leorg99 commented Apr 25, 2021

In FreePBX -> Settings -> Asterisk Logfile Settings, you can configure log rotation. I believe this uses logrotate, as it appears to configure it in /etc/logrotate.d/asterisk. Running logrotate /etc/logrotate.conf -v -f inside the container rotates the asterisk logs as expected. However, I think the container is missing a service to run this daily.

Looking at /lib/systemd/system/, there is logrotate.service and logrotate.timer, which suggests there should be something similar in /etc/init.d, but I am not seeing it. On my host OS (Ubuntu Server 20.04), I also see a cron job at /etc/cron.daily/logrotate with the following:

$ cat /etc/cron.daily/logrotate
#!/bin/sh

# skip in favour of systemd timer
if [ -d /run/systemd/system ]; then
    exit 0
fi

# this cronjob persists removals (but not purges)
if [ ! -x /usr/sbin/logrotate ]; then
    exit 0
fi

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit $EXITVALUE

I am not completely sure what the solution is here, but I think it involves either adding an init.d service for logrotate with a timer or a daily cron job.

@leorg99
Copy link
Author

leorg99 commented May 25, 2021

Update:
I believe this is now working with the following envs set:

      - "ENABLE_LOGROTATE=TRUE"
      - "ENABLE_CRON=TRUE"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant