Movatterモバイル変換


[0]ホーム

URL:


Loading
  1. Elastic Docs/
  2. Solutions and use cases/
  3. Observability solution/
  4. Applications and services/
  5. Application performance monitoring (APM)/
  6. Work with APM Server/
  7. Configure/
  8. Advanced setup

APM Server and systemd

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.

Usesystemctl 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, usesystemctl:

systemctl status apm-server

Logs are stored by default in journald. To view the Logs, usejournalctl:

journalctl -u apm-server.service

The systemd service unit file includes environment variables that you can override to change the default options.

VariableDescriptionDefault value
BEAT_LOG_OPTSLog options
BEAT_CONFIG_OPTSFlags for configuration file path-c /etc/apm-server/apm-server.yml
BEAT_PATH_OPTSOther paths-path.home /usr/share/apm-server -path.config /etc/apm-server -path.data /var/lib/apm-server -path.logs /var/log/apm-server
Note

You can useBEAT_LOG_OPTS to set debug selectors for logging. However, to configure logging behavior, set the logging options described inConfigure logging.

To override these variables, create a drop-in unit file in the/etc/systemd/system/apm-server.service.d directory.

For example a file with the following content placed in/etc/systemd/system/apm-server.service.d/debug.conf would overrideBEAT_LOG_OPTS to enable debug for Elasticsearch output.

[Service]Environment="BEAT_LOG_OPTS=-d elasticsearch"

To apply your changes, reload the systemd configuration and restart the service:

systemctl daemon-reloadsystemctl restart apm-server
Note

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, usesystemctl edit apm-server.service.

Note

In most cases, you don’t need to manually configure thenofile limit when running APM Server.

On systemd-based systems, the defaultLimitNOFILE is1024 (soft) and524288 (hard). Most Linux distributions do not override or significantly reduce these defaults.

Starting with Go 1.19 (golang/go#46279), the Go runtime automatically raises the soft limit to match the available hard limit. As a result, APM Server typically runs with the maximum allowednofile limit provided by the operating system, which is often524287 on modern systems.

There is usually no need to manually change this limit, as back-pressure from too many open files happens through memory usage.

For guidance on manually setting thenofile limit, refer toModify thenofile ulimit.

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 byapm-server, and have file permissions of0600 (-rw-------).

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 toroot:root

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, usechmod 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.


[8]ページ先頭

©2009-2026 Movatter.jp