Skip to content

Commit 9b2ad7f

Browse files
authored
DOC-3978 RS: Update log rotation default config to reduce filling disk space with logs (#507)
1 parent 047657f commit 9b2ad7f

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

content/operate/rs/clusters/logging/log-security.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@ By default, log rotation occurs when a log exceeds 200 MB. We recommend sending
2626
The following log rotation policy is enabled by default in Redis Enterprise Software, but you can modify it as needed.
2727

2828
```sh
29-
/var/opt/redislabs/log/*.log {
29+
${logdir}/*.log {
3030
su ${osuser} ${osgroup}
31-
size 200M
31+
maxsize 200M
32+
daily
3233
missingok
3334
copytruncate
34-
# 2000 is logrotate's way of saying 'infinite'
35-
rotate 2000
35+
rotate 10
3636
maxage 7
3737
compress
3838
notifempty
3939
nodateext
4040
nosharedscripts
4141
prerotate
4242
# copy cluster_wd log to another file that will have longer retention
43-
if [ "\$1" = "/var/opt/redislabs/log/cluster_wd.log" ]; then
44-
cp -p /var/opt/redislabs/log/cluster_wd.log /var/opt/redislabs/log/cluster_wd.log.long_retention
43+
if [ "\$1" = "${logdir}/cluster_wd.log" ]; then
44+
cp -p ${logdir}/cluster_wd.log ${logdir}/cluster_wd.log.long_retention
4545
fi
4646
endscript
4747
}
48-
/var/opt/redislabs/log/cluster_wd.log.long_retention {
48+
${logdir}/cluster_wd.log.long_retention {
4949
su ${osuser} ${osgroup}
5050
daily
5151
missingok
@@ -57,23 +57,25 @@ The following log rotation policy is enabled by default in Redis Enterprise Soft
5757
}
5858
```
5959

60-
- `/var/opt/redislabs/log/*.log` - `logrotate` checks the files under the `$logdir` directory (`/var/opt/redislabs/log/`) and rotates any files that end with the extension `.log`.
60+
- `${logdir}/*.log`: `logrotate` checks the files under the `$logdir` directory (`/var/opt/redislabs/log/`) and rotates any files that end with the extension `.log`.
61+
62+
- `${logdir}/cluster_wd.log.long_retention`: `cluster_wd.log` is copied to `cluster_wd.log.long_retention` before rotation. This copy is kept longer than usual, which is 30 days by default.
6163

62-
- `/var/opt/redislabs/log/cluster_wd.log.long_retention` - The contents of `cluster_wd.log` is copied to `cluster_wd.log.long_retention` before rotation, and this copy is kept for longer than normal (30 days).
64+
- `maxsize 200M`: Rotate log files that exceed 200 MB.
6365

64-
- `size 200M` - Rotate log files that exceed 200 MB.
66+
- `daily`: Rotate logs every day regardless of their size.
6567

66-
- `missingok` - If there are missing log files, do nothing.
68+
- `missingok`: If there are missing log files, do nothing.
6769

68-
- `copytruncate` - Truncate the original log file to zero sizes after creating a copy.
70+
- `copytruncate`: Truncate the original log file to zero sizes after creating a copy.
6971

70-
- `rotate 2000` - Keep up to 2000 (effectively infinite) log files.
72+
- `rotate 10`: Save a maximum of 10 rotated log files. To keep effectively infinite log files, use `rotate 2000` instead.
7173

72-
- `compress` - gzip log files.
74+
- `compress`: gzip log files.
7375

74-
- `maxage 7` - Keep the rotated log files for 7 days.
76+
- `maxage 7`: Keep the rotated log files for 7 days.
7577

76-
- `notifempty` - Don't rotate the log file if it is empty.
78+
- `notifempty`: Don't rotate the log file if it is empty.
7779

7880
{{<note>}}
7981
For large scale deployments, you might need to rotate logs at faster intervals than daily. You can also use a cronjob or external vendor solutions.

0 commit comments

Comments
 (0)