-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add log rotation with "logrotate" (#409)
## Issue [ISSUE-398](#398) At the current moment Charmed MongoDB logs, can grow very fast, especially audit log. For example when a user imports data sets. ## Solution Support log rotation to avoid consuming too much space with log files. Log will be rotated if they grow bigger than 100M, the check for log files size will be performed every minute ## Result of log rotation <img width="635" alt="Screenshot 2024-04-23 at 18 59 47" src="https://github.com/canonical/mongodb-operator/assets/132273757/c1ccbd81-ca9d-4678-9423-0f2374f7226d">
- Loading branch information
1 parent
89c933f
commit 34dba61
Showing
11 changed files
with
155 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ parameterized==0.9.0 | |
pydantic==1.10.7 | ||
# Future PR - use poetry in MongoDB Charm | ||
poetry==1.8.2 | ||
jinja2==3.1.3 |
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,16 @@ | ||
{{logs_directory}}/*.log | ||
{ | ||
rotate {{max_rotations}} | ||
size {{max_log_size}} | ||
missingok | ||
notifempty | ||
create 0600 {{mongo_user}} {{mongo_user}} | ||
compress | ||
nomail | ||
nocopytruncate | ||
sharedscripts | ||
postrotate | ||
/bin/kill -SIGUSR1 $(systemctl show -p MainPID --value snap.charmed-mongodb.mongod.service) | ||
endscript | ||
} | ||
|
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
Oops, something went wrong.