Audit: Support audit log file rotation #600
Open
+86
−9
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.
Description
Allow to natively configure Vault file audit device log file rotation with the
audit enable
command by adding 3 new options to the file backend. These 3 new options and their default values are as follows:max_files
:(int: 0)
- The maximum number of older audit log file archives to keep. Defaults to0
(no files are ever deleted). Set to-1
to discard old audit log files when a new one is created.max_bytes
:(int: 0)
- The number of bytes that should be written to an audit log file before it needs to be rotated. Unless specified, there is no limit to the number of bytes that can be written to a log file.max_duration
:(string: "24h")
- The maximum duration an audit log file should be written to before it needs to be rotated. Must be a duration value such as"30s"
. Defaults to"24h"
. If no time unit is specified, the time duration number is assumed to be in seconds. Set to0
to disable time-based log file rotation.By default, audit log file rotation is set to occur every 24 hours, with no older log file ever removed. In order to revert to previous behavior, where log rotation was not handled by the Vault, the
max_duration
option must be set to0
, as all other new options are already set to0
by default.See Vault PR 31213.