The DEB and RPM packages include a service unit for Linux systems with systemd. On these systems, you can manage APM Server by using the usual systemd commands.
We recommend that the apm-server process is run as a non-root user. Therefore, that is the default setup for APM Server’s DEB package and RPM installation.
systemctl to start or stop APM Server:
sudo systemctl start apm-server
sudo systemctl stop apm-server
By default, the APM Server service starts automatically when the system boots. To enable or disable auto start use:
sudo systemctl enable apm-server
sudo systemctl disable apm-server
To get the service status, use
systemctl status apm-server
Logs are stored by default in journald. To view the Logs, use
journalctl -u apm-server.service
The unit file included in the packages sets the
-e flag by default.
This flag makes APM Server log to stderr and disables other log outputs.
Systemd stores all output sent to stderr in journald.
Customize systemd unit for APM Serveredit
The systemd service unit file includes environment variables that you can override to change the default options.
Flags for configuration file path
To override these variables, create a drop-in unit file in the
For example a file with the following content placed in
BEAT_LOG_OPTS to enable debug for Elasticsearch output.
[Service] Environment="BEAT_LOG_OPTS=-e -d elasticsearch"
To change the logging output from the APM Server configuration file, empty the environment variable. For example:
To apply your changes, reload the systemd configuration and restart the service:
systemctl daemon-reload systemctl restart apm-server
It is recommended that you use a configuration management tool to
include drop-in unit files. If you need to add a drop-in manually, use
systemctl edit apm-server.service.
On systems with POSIX file permissions, the APM Server configuration file is subject to ownership and file permission checks. These checks prevent unauthorized users from providing or modifying configurations that are run by APM Server.
When installed via an RPM or DEB package,
the configuration file at
/etc/apm-server/apm-server.yml will be owned by
and have file permissions of
APM Server will only start if the configuration file is owned by the user running the process,
or by running as root with configuration ownership set to
You may encounter the following errors if your configuration file fails these checks:
Exiting: error loading config file: config file ("/etc/apm-server/apm-server.yml") must be owned by the user identifier (uid=1000) or root
To correct this problem you can change the ownership of the configuration file with:
chown apm-server:apm-server /etc/apm-server/apm-server.yml.
You can also make root the config owner, although this is not recommended:
sudo chown root:root /etc/apm-server/apm-server.yml.
Exiting: error loading config file: config file ("/etc/apm-server/apm-server.yml") can only be writable by the owner but the permissions are "-rw-rw-r--" (to fix the permissions use: 'chmod go-w /etc/apm-server/apm-server.yml')
To correct this problem, use
chmod go-w /etc/apm-server/apm-server.yml to
remove write privileges from anyone other than the owner.
You can disable strict permission checks from the command line by using
--strict.perms=false, but we strongly encourage you to leave the checks enabled.