How to load filebeat or elastic config from a non-default location

I am using filebeat on my Linux machine as a service (i.e. sudo service start filebeat). The service is started with the config file from the default location:

● filebeat.service - Filebeat sends log files to Logstash or directly to Elasticsearch.
   Loaded: loaded (/lib/systemd/system/filebeat.service; enabled; vendor preset: enabled)
     Docs: https://www.elastic.co/products/beats/filebeat
 Main PID: 4097 (filebeat)
   CGroup: /system.slice/filebeat.service
           └─4097 /usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat.yml -path.home /usr/share/filebeat -path.

systemd[1]: Started Filebeat sends log files to Logstash or directly to Elasticsearch..

How can I tell the service to load the config file from another location?

You can do it as you would do it for other systemd services. You can either edit the service file under /lib/systemd/system and change the config path to the desired one.

[Service]
ExecStart=/usr/share/filebeat/bin/filebeat -c {{ path-to-your-config }} -path.home /usr/share/filebeat -path.config /etc/filebeat -path.data /var/lib/filebeat -path.logs /var/log/filebeat

Or you can override the option as described here: https://askubuntu.com/questions/659267/how-do-i-override-or-configure-systemd-services

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.