-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
[[running-with-systemd]] | ||
=== { beatname_uc } and systemd | ||
|
||
DEB and RPM packages include a service unit for Linux systems with systemd. On | ||
these systems { beatname_uc } can be managed with the usual systemd commands: | ||
|
||
==== Starting and stoping { beatname_uc} | ||
|
||
When using systemd, { beatname_uc } can be started or stopped with `systemctl`. | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl start {beatname_lc} | ||
------------------------------------------------ | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl stop {beatname_lc} | ||
------------------------------------------------ | ||
|
||
Service start on system boot can be enabled or disabled with `systemctl`, | ||
{ beatname_uc } is enabled when installed. | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl enable {beatname_lc} | ||
------------------------------------------------ | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl disable {beatname_lc} | ||
------------------------------------------------ | ||
|
||
|
||
==== { beatname_uc } status and logs | ||
|
||
Service status can be also obtained with `systemctl`. | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl start {beatname_lc} | ||
------------------------------------------------ | ||
|
||
Logs are stored by default in journald, they can be viewed with `journalctl`. | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
journalctl -u {beatname_lc}.service | ||
------------------------------------------------ | ||
|
||
NOTE: Unit file included in packages sets by default `-e` flag, that flag makes | ||
{ beatname_uc } to log to stderr and disables other log outputs. Systemd stores | ||
all output sent to stderr in journald. | ||
|
||
[float] | ||
=== Customizing systemd unit for { beatname_uc } | ||
|
||
Systemd service unit file includes some environment variables that can be | ||
overriden to change default options. | ||
[cols="<h,<,<m,<m",options="header",] | ||
|======================================= | ||
| Variable | Description | Default value | ||
| BEAT_LOG_OPTS | Log options | `-e` | ||
| BEAT_CONFIG_OPTS | Flags for configuration file path | `-c /etc/{ beatname_lc }/{ beatname_lc }.yml` | ||
| BEAT_PATH_OPTS | Other paths | -path.home /usr/share/{ beatname_lc } -path.config /etc/{ beatname_lc } -path.data /var/lib/{ beatname_lc } -path.logs /var/log/{ beatname_lc } | ||
|======================================= | ||
|
||
These variables can be overriden with a drop-in unit file placed in `/etc/systemd/system/{ beatname_lc }.service.d` directory. | ||
|
||
For example a file with the following content placed in `/etc/systemd/system/{ beatname_lc }.service.d/debug.conf` | ||
would override `BEAT_LOG_OPTS` to enable debug for Elasticsearch output. | ||
|
||
["source", "systemd", subs="attributes"] | ||
------------------------------------------------ | ||
[Service] | ||
Environment=BEAT_LOG_OPTS="-e -d elasticsearch" | ||
------------------------------------------------ | ||
|
||
It can also be emptied to rely on settings on the configuration file for | ||
logging. | ||
|
||
["source", "systemd", subs="attributes"] | ||
------------------------------------------------ | ||
[Service] | ||
Environment=BEAT_LOG_OPTS="" | ||
------------------------------------------------ | ||
|
||
Remember to reload systemd configuration and restart the service to apply | ||
changes on these files. | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl daemon-reload | ||
systemctl restart { beatname_lc } | ||
------------------------------------------------ | ||
|
||
NOTE: It is recommended to use some configuration management tool to include | ||
drop-in unit files, but when needed to add a drop-in by hand `systemctl edit { beatname_lc }.service | ||
can be used- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters