Search code examples
dockersupervisordfilebeat

Start Filebeat using Supervisor


So I have a CentOS Docker image containing Filebeat and a few other services which I'm trying to manage using Supervisor. As part of the Supervisor configuration, I want to start the Filebeat service. Here's what I'm trying in supervisord.conf

[program:filebeat]
command=/etc/init.d/filebeat start
directory=/etc/init.d/
autostart=true
autorestart=true

The snippet above gives me an error stating "Failed to get D-Bus connection: Operation not permitted".

Any thoughts on what's the right way to start Filebeat?


Solution

  • I would recommend running Filebeat in its own container. But if you are going to use supervisord then you don't want to daemonize the process. You will want to use a command that's similar to what Filebeat uses for systemd.

    command=/usr/share/filebeat/bin/filebeat -e
        -c /etc/filebeat/filebeat.yml 
        -path.home /usr/share/filebeat
        -path.config /etc/filebeat
        -path.data /var/lib/filebeat
        -path.logs /var/log/filebeat
    

    The -e tells the process to writes its logs to stderr so you can manage logging with supervisorctl.