-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log by default to journald on systems with systemd #8942
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d0384ef
Log by default to journald on systems with systemd
jsoriano fa771b6
Changelog updated
jsoriano 8eab223
Add documentation for systemd
jsoriano dee595d
Merge remote-tracking branch 'origin/master' into systemd-unit-logging
jsoriano 27cf3d3
Merge remote-tracking branch 'origin/master' into systemd-unit-logging
jsoriano eb2d040
Address comments from review
jsoriano a7da067
Merge branch 'master' into systemd-unit-logging
jsoriano d4a1285
Merge remote-tracking branch 'origin/master' into systemd-unit-logging
jsoriano 0b32cda
Apply suggested changes to documentation
jsoriano 1886705
Wrap commands with attributes with plus signs
jsoriano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,103 @@ | ||
[[running-with-systemd]] | ||
=== {beatname_uc} and systemd | ||
|
||
The DEB and RPM packages include a service unit for Linux systems with | ||
systemd. On these systems, you can manage {beatname_uc} by using the usual | ||
systemd commands. | ||
|
||
==== Start and stop {beatname_uc} | ||
|
||
Use `systemctl` to start or stop {beatname_uc}: | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl start {beatname_lc} | ||
------------------------------------------------ | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl stop {beatname_lc} | ||
------------------------------------------------ | ||
|
||
By default, the {beatname_uc} service starts automatically when the system | ||
boots. To enable or disable auto start use: | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl enable {beatname_lc} | ||
------------------------------------------------ | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl disable {beatname_lc} | ||
------------------------------------------------ | ||
|
||
|
||
==== {beatname_uc} status and logs | ||
|
||
To get the service status, use `systemctl`: | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl status {beatname_lc} | ||
------------------------------------------------ | ||
|
||
Logs are stored by default in journald. To view the Logs, use `journalctl`: | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
journalctl -u {beatname_lc}.service | ||
------------------------------------------------ | ||
|
||
NOTE: The unit file included in the packages sets the `-e` flag by default. | ||
This flag makes {beatname_uc} log to stderr and disables other log outputs. | ||
Systemd stores all output sent to stderr in journald. | ||
|
||
[float] | ||
=== Customize systemd unit for {beatname_uc} | ||
|
||
The systemd service unit file includes environment variables that you can | ||
override to change the default options. | ||
|
||
[cols="<h,<,<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} | ||
|======================================= | ||
|
||
To override these variables, create a drop-in unit file in the | ||
+/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" | ||
------------------------------------------------ | ||
|
||
To use settings from the {beatname_uc} file, empty the environment | ||
variable. For example: | ||
|
||
["source", "systemd", subs="attributes"] | ||
------------------------------------------------ | ||
[Service] | ||
Environment=BEAT_LOG_OPTS="" | ||
------------------------------------------------ | ||
|
||
To apply your changes, reload the systemd configuration and restart | ||
the service: | ||
|
||
["source", "sh", subs="attributes"] | ||
------------------------------------------------ | ||
systemctl daemon-reload | ||
systemctl restart {beatname_lc} | ||
------------------------------------------------ | ||
|
||
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, use | ||
`systemctl edit {beatname_lc}.service`. | ||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change:
To
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, true, you already mentioned that, thanks!
I have wrapped a couple more command lines that were unwrapped.