Logrotate Error

  • Hi all,


    I have installed syslog-ng (balabit/syslog-ng) in a docker container and pointed OMV to it and it is working fine.


    I want to be able to rotate the logs so I'm using syslog-ng's built-in logrotate file /etc/logrotate.d/syslog-ng:



    However I'm getting the following error:



    Code
    root@omv:/etc# docker exec syslog-ng /usr/sbin/logrotate -f /etc/logrotate.d/syslog-ng
    invoke-rc.d: could not determine current runlevel
    invoke-rc.d: policy-rc.d denied execution of reload.
    root@omv:/etc# 


    The problem seems to be doing the reload of syslog-ng.

    I've tried several ideas that I found on the internet but none has fixed the problem.


    Any ideas greatly appreciated.


    TIA

    OMV 6 Lenovo M910q - Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz 16GB RAM

  • Did you read that:


    Deprecation warning

    This repository has been deprecated and is no longer maintained. It has been superseded by syslog-ng, where the syslog-ng Docker image is published automatically after each release.


    Unfortunatel< they shut down the wiki: logrotate outside the container.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • I'm sorry but I am confused. Your syslog-ng link goes to a page that says:


    KhHu2DQ.jpeg

    With the Your central log server in Docker link going to a page saying:



    docker run -it -v /data/syslog-ng/conf/syslog-ng.conf:/etc/syslog-ng/syslog-ng.conf -v /data/syslog-ng/logs:/var/log -p 514:514 -p 601:601 –name syslog-ng balabit/syslog-ng:latest -edv



    Note the name of the image is the same as the one I'm using.



    EDIT: I get the same result running the logrotate command either inside or outside the container.

    OMV 6 Lenovo M910q - Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz 16GB RAM

    Einmal editiert, zuletzt von gregeeh ()

  • I am confused too, as I expected them to change the name of the container, but obviously they did not.
    In the contaienr syslog is runninf as pid 1 (no init process, no runlevels), so invoke-rc.d does not work. You can rotate the logs from outside and send a signal to the container process.


    There is some kind of docmentation on this in the closed issues of the old project. The wiki had a description, but is no longer available.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • After many hours of searching I have found the answer, so I will post it here in case others have the same problem.


    Syslog-ng needs specific POSIX capability flags. But docker does not grant them by default.


    Here's my docker run command:



    The --cap-add options were needed to give the correct permissions and stop the "Error setting capabilities, capability management disabled; error='Operation not permitted" message in the syslog-ng logs when started.


    You also need to edit /etc/logrotate.d/syslog-ng and change this:


    invoke-rc.d syslog-ng reload > /dev/null


    to this:


    syslog-ng-ctl reload > /dev/null


    in two places.


    Hope this helps someone.

    OMV 6 Lenovo M910q - Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz 16GB RAM

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!