This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Change the default log config to reduce disk I/O and storage #8040
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1af663d
Change default log config to buffer by default.
erikjohnston 29b921e
Default to keeping last 4 days of logs.
erikjohnston ed8a183
Newsfile
erikjohnston 07465f0
Remove spurious level: DEBUG
erikjohnston 5936b1a
Review comments
erikjohnston c2fc81e
Move setting of Filter into code.
erikjohnston 5590a73
Flush at WARNING logs as well
erikjohnston dd0b6f2
Revert "Move setting of Filter into code."
erikjohnston e7d2a9e
Reduce default buffer capacity and doc the option
erikjohnston 62289fa
Document console handler
erikjohnston 538efd0
Update wording as per review
erikjohnston 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 @@ | ||
| Change the default log config to reduce disk I/O and storage for new servers. |
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 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,13 +18,29 @@ filters: | |||||||||||||||||||
|
|
||||||||||||||||||||
| handlers: | ||||||||||||||||||||
| file: | ||||||||||||||||||||
| class: logging.handlers.RotatingFileHandler | ||||||||||||||||||||
| class: logging.handlers.TimedRotatingFileHandler | ||||||||||||||||||||
| formatter: precise | ||||||||||||||||||||
| filename: /var/log/matrix-synapse/homeserver.log | ||||||||||||||||||||
| maxBytes: 104857600 | ||||||||||||||||||||
| backupCount: 10 | ||||||||||||||||||||
| filters: [context] | ||||||||||||||||||||
| when: midnight | ||||||||||||||||||||
| backupCount: 3 # Does not include the current log file. | ||||||||||||||||||||
| encoding: utf8 | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Default to buffering writes to log file for efficiency. This means that | ||||||||||||||||||||
| # will be a delay for INFO/DEBUG logs to get written, but WARNING/ERROR | ||||||||||||||||||||
| # logs will still be flushed immediately. | ||||||||||||||||||||
| buffer: | ||||||||||||||||||||
| class: logging.handlers.MemoryHandler | ||||||||||||||||||||
| filters: [context] | ||||||||||||||||||||
| target: file | ||||||||||||||||||||
| # The capacity is the number of log lines that are buffered before | ||||||||||||||||||||
| # being written to disk. Increasing this will lead to better | ||||||||||||||||||||
| # performance, at the expensive of it taking longer for log lines to | ||||||||||||||||||||
| # be written to disk. | ||||||||||||||||||||
| capacity: 10 | ||||||||||||||||||||
| flushLevel: 30 # Flush for WARNING logs as well | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # A handler that writes logs to stderr. Unused by default, but can be used | ||||||||||||||||||||
| # instead of "buffer" and "file" in the logger handlers. | ||||||||||||||||||||
| console: | ||||||||||||||||||||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
| class: logging.StreamHandler | ||||||||||||||||||||
| formatter: precise | ||||||||||||||||||||
|
|
@@ -36,8 +52,18 @@ loggers: | |||||||||||||||||||
| # information such as access tokens. | ||||||||||||||||||||
| level: INFO | ||||||||||||||||||||
|
|
||||||||||||||||||||
| twisted: | ||||||||||||||||||||
| # We send the twisted logging directly to the file handler, | ||||||||||||||||||||
| # to work around https://github.com/matrix-org/synapse/issues/3471 | ||||||||||||||||||||
| # when using "buffer" logger. Use "console" to log to stderr instead. | ||||||||||||||||||||
| handlers: [file] | ||||||||||||||||||||
| propagate: false | ||||||||||||||||||||
|
|
||||||||||||||||||||
| root: | ||||||||||||||||||||
| level: INFO | ||||||||||||||||||||
| handlers: [file, console] | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # By default buffer logs in memory before logging to file. Replace "buffer" | ||||||||||||||||||||
| # with "console" to log to stderr instead. | ||||||||||||||||||||
|
||||||||||||||||||||
| # By default buffer logs in memory before logging to file. Replace "buffer" | |
| # with "console" to log to stderr instead. | |
| # Write logs to the `buffer` handler, which will buffer them together in memory, | |
| # then write them to a file. | |
| # | |
| # Replace "buffer" with "console" to log to stderr instead. (Note that you'll | |
| # also need to update the configuation for the `twisted` logger above, in | |
| # this case.) | |
| # |
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.
Uh oh!
There was an error while loading. Please reload this page.