管理日志
Redis 企业软件 |
---|
Redis Enterprise 在服务器上附带了一组日志,可通过用户界面使用,以帮助用户调查在服务器上执行的作并解决问题。
将日志发送到远程日志记录服务器
默认情况下,Redis Enterprise 将日志发送到 syslog。您可以通过配置 syslog 将这些日志发送到远程日志记录服务器。
为此,请修改作系统上的 syslog 或 rsyslog 配置,以在$logdir
目录 (/var/opt/redislabs/log
在默认安装中)连接到您选择的远程监控服务器。有关更多详细信息,请参阅 rsyslog 日志记录。
日志轮换
Redis Enterprise Software 的作业计划程序运行logrotate
每 5 分钟检查一次存储在作系统上的日志,并根据日志轮换配置轮换日志。您可以在以下位置找到日志轮换配置文件$pkgconfdir/logrotate.conf
从 Redis Enterprise Software 版本 7.2 (pkgconfdir
是/opt/redislabs/config
默认情况下,但可以在自定义安装中更改)。
默认情况下,当日志超过 200 MB 时,将进行日志轮换。我们建议将日志文件发送到远程日志记录服务器,以便您可以更有效地维护它们。
Redis Enterprise Software 默认启用以下日志轮换策略,但您可以根据需要对其进行修改。
${logdir}/*.log {
su ${osuser} ${osgroup}
maxsize 200M
daily
missingok
copytruncate
rotate 10
maxage 7
compress
notifempty
nodateext
nosharedscripts
prerotate
# copy cluster_wd log to another file that will have longer retention
if [ "\$1" = "${logdir}/cluster_wd.log" ]; then
cp -p ${logdir}/cluster_wd.log ${logdir}/cluster_wd.log.long_retention
fi
endscript
}
${logdir}/cluster_wd.log.long_retention {
su ${osuser} ${osgroup}
daily
missingok
copytruncate
rotate 30
compress
notifempty
nodateext
}
-
${logdir}/*.log
:logrotate
checks the files under the$logdir
directory (/var/opt/redislabs/log/
) and rotates any files that end with the extension.log
. -
${logdir}/cluster_wd.log.long_retention
:cluster_wd.log
is copied tocluster_wd.log.long_retention
before rotation. This copy is kept longer than usual, which is 30 days by default. -
maxsize 200M
: Rotate log files that exceed 200 MB. -
daily
: Rotate logs every day regardless of their size. -
missingok
: If there are missing log files, do nothing. -
copytruncate
: Truncate the original log file to zero sizes after creating a copy. -
rotate 10
: Save a maximum of 10 rotated log files. To keep effectively infinite log files, userotate 2000
instead. -
compress
: gzip log files. -
maxage 7
: Keep the rotated log files for 7 days. -
notifempty
: Don't rotate the log file if it is empty.
Note:
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.
On this page