-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DOCS-2315: updates log rotate tutorial with new steps && new behaviors #2167
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
Closed
Closed
Changes from all commits
Commits
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 hidden or 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,55 @@ | ||
stepnum: 1 | ||
ref: start-mongod | ||
title: "Start a :program:`mongod` instance." | ||
action: | ||
language: sh | ||
code: | | ||
mongod -v --logpath /var/log/mongodb/server1.log | ||
post: | | ||
You can also explicitly specify :option:`logRotate --rename | ||
<--logRotate>`. | ||
--- | ||
stepnum: 2 | ||
title: List the log files | ||
ref: list-logfiles | ||
pre: | | ||
In a separate terminal, list the matching files: | ||
action: | ||
language: sh | ||
code: | | ||
ls /var/log/mongodb/server1.log* | ||
post: | | ||
The results should include one log file, ``server1.log``. | ||
--- | ||
stepnum: 3 | ||
ref: rotate-log | ||
title: Rotate the log file. | ||
pre: | | ||
Rotate the log file by issuing the :dbcommand:`logRotate` command | ||
from the ``admin`` database in a :program:`mongo` shell: | ||
action: | ||
language: sh | ||
code: | | ||
use admin | ||
db.runCommand( { logRotate : 1 } ) | ||
--- | ||
stepnum: 4 | ||
ref: list-new-logfiles | ||
title: 'View the new log files' | ||
pre: | | ||
List the new log files to view the newly-created log: | ||
action: | ||
language: sh | ||
code: | | ||
ls /var/log/mongodb/server1.log* | ||
post: | | ||
There should be two log files listed: ``server1.log``, which is the | ||
log file that :program:`mongod` or :program:`mongos` made when it | ||
reopened the log file, and ``server1.log.<timestamp>``, the renamed | ||
original log file. | ||
|
||
Rotating log files does not modify the "old" rotated log files. When | ||
you rotate a log, you rename the ``server1.log`` file to include | ||
the timestamp, and a new, empty ``server1.log`` file receives all | ||
new log input. | ||
... |
This file contains hidden or 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,24 @@ | ||
stepnum: 1 | ||
ref: rotate-logs-reopen | ||
title: "Start a :program:`mongod` instance, specifying the ``reopen`` :option:`--logRotate` behavior." | ||
action: | ||
language: sh | ||
code: | | ||
mongod -v --logpath /var/log/mongodb/server1.log --logRotate reopen --logappend | ||
post: | | ||
You must use the :option:`--logappend` option with | ||
:option:`--logRotate reopen <--logRotate>`. | ||
--- | ||
stepnum: 2 | ||
source: | ||
file: steps-log-rotate-rename.yaml | ||
ref: list-logfiles | ||
--- | ||
stepnum: 3 | ||
source: | ||
file: steps-log-rotate-rename.yaml | ||
ref: rotate-log | ||
post: | | ||
You should rename the log file using an external process, following | ||
the typical Linux/Unix log rotate behavior. | ||
... |
This file contains hidden or 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,23 @@ | ||
stepnum: 1 | ||
ref: start-mongod-syslog | ||
title: 'Start a :program:`mongod` instance with the :option:`--syslog` option' | ||
action: | ||
language: sh | ||
code: | | ||
mongod --syslog | ||
post: | | ||
Do not include :option:`--logpath`. Since :option:`--syslog` tells | ||
:program:`mongod` to send log data to the syslog, specifying a | ||
:option:`--logpath` will causes an error. | ||
|
||
To specify the facility level used when logging messages to the syslog, | ||
use the :option:`--syslogFacility` option or | ||
:setting:`systemLog.syslogFacility` configuration setting. | ||
--- | ||
stepnum: 2 | ||
ref: rotate-log-syslog | ||
title: Rotate the log. | ||
pre: | | ||
Store and rotate the log output using your systems default log | ||
rotation mechanism. | ||
... |
This file contains hidden or 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.
this won't build because no ref in yaml
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.
indeed. jeez.