1

亲爱的朋友和大学

我们在一个月前安装了 preso 集群

我们对 presto 的日志感到非常惊讶

我们看到日志没有被清除 /home/presto/data/var/log

所以日志每周都会增加磁盘上的使用大小

目前所有日志都在 ~100M 左右,下个月将达到 200M

而且我们没有找到清除旧日志的方法,或者我们错过了一些东西

当然我们可以使用简单的删除语法作为

find  `/home/presto/data/var/log  -type f -mtime +40 -regex '.*\.log.*[0-9]$' -delete

但这种解决方法应该是最新的解决方案

-rw-r--r-- 1 root root    72190 Feb 17 12:59 server.log-2019-02-14.0.log.gz
-rw-r--r-- 1 root root    12647 Feb 18 08:40 server.log-2019-02-17.0.log.gz
-rw-r--r-- 1 root root   212909 Feb 19 07:15 server.log-2019-02-18.0.log.gz
-rw-r--r-- 1 root root   131321 Feb 21 13:47 server.log-2019-02-19.0.log.gz
-rw-r--r-- 1 root root    25290 Feb 25 11:24 server.log-2019-02-21.0.log.gz
-rw-r--r-- 1 root root    12875 Feb 26 11:22 server.log-2019-02-25.0.log.gz
-rw-r--r-- 1 root root  4064640 Feb 27 14:59 http-request.log-2019-02-27.0.log.gz
-rw-r--r-- 1 root root    24101 Feb 27 19:22 server.log-2019-02-26.0.log.gz
-rw-r--r-- 1 root root  2617843 Feb 28 00:00 http-request.log-2019-02-27.1.log.gz
-rw-r--r-- 1 root root      435 Feb 28 06:28 server.log-2019-02-27.0.log.gz
-rw-r--r-- 1 root root  3808094 Mar  1 00:00 http-request.log-2019-02-28.0.log.gz
-rw-r--r-- 1 root root  1881506 Mar  2 00:00 http-request.log-2019-03-01.0.log.gz
-rw-r--r-- 1 root root  1884936 Mar  3 00:00 http-request.log-2019-03-02.0.log.gz
-rw-r--r-- 1 root root      458 Mar  3 12:22 server.log-2019-02-28.0.log.gz
-rw-r--r-- 1 root root  1885882 Mar  4 00:00 http-request.log-2019-03-03.0.log.gz
-rw-r--r-- 1 root root      216 Mar  4 11:34 server.log-2019-03-03.0.log.gz
-rw-r--r-- 1 root root  1919315 Mar  5 00:00 http-request.log-2019-03-04.0.log.gz
-rw-r--r-- 1 root root     1062 Mar  5 14:05 server.log-2019-03-04.0.log.gz
-rw-r--r-- 1 root root  1889722 Mar  6 00:00 http-request.log-2019-03-05.0.log.gz
-rw-r--r-- 1 root root       34 Mar  6 13:05 server.log-2019-03-05.0.log.gz
-rw-r--r-- 1 root root  1904985 Mar  7 00:00 http-request.log-2019-03-06.0.log.gz
-rw-r--r-- 1 root root   133638 Mar  7 01:49 server.log-2019-03-06.0.log.gz
-rw-r--r-- 1 root root  1872370 Mar  8 00:00 http-request.log-2019-03-07.0.log.gz
-rw-r--r-- 1 root root  1876450 Mar  9 00:00 http-request.log-2019-03-08.0.log.gz
-rw-r--r-- 1 root root    74006 Mar  9 03:03 server.log-2019-03-07.0.log.gz
-rw-r--r-- 1 root root  1882214 Mar 10 00:00 http-request.log-2019-03-09.0.log.gz
-rw-r--r-- 1 root root      623 Mar 10 00:31 server.log-2019-03-09.0.log.gz
-rw-r--r-- 1 root root  1758532 Mar 11 00:00 http-request.log-2019-03-10.0.log.gz
-rw-r--r-- 1 root root      913 Mar 11 00:49 server.log-2019-03-10.0.log.gz
-rw-r--r-- 1 root root  1567139 Mar 12 00:00 http-request.log-2019-03-11.0.log.gz
-rw-r--r-- 1 root root   167739 Mar 12 12:57 server.log-2019-03-11.0.log.gz
-rw-r--r-- 1 root root    33255 Mar 12 22:15 launcher.log
-rw-r--r-- 1 root root  1575402 Mar 13 00:00 http-request.log-2019-03-12.0.log.gz
-rw-r--r-- 1 root root    69898 Mar 13 04:38 server.log-2019-03-12.0.log.gz
-rw-r--r-- 1 root root     1216 Mar 13 15:22 server.log
-rw-r--r-- 1 root root  1663740 Mar 14 00:00 http-request.log-2019-03-13.0.log.gz
4

1 回答 1

3

您可以通过在服务器 config.properties 文件 ( https://trino.io/docs/current/installation/deployment.html#config-properties )中设置以下选项来配置服务器日志 (server.log.XXXX) 的日志保留:

  • log.max-history:要保留的存档文件的最大数量。默认值为 30。
  • log.max-size:每个文件的最大(未压缩)大小。默认值为 100 MB。

例如,如果您只想保留 10 个文件,每个文件不超过 5MB(未压缩),您可以设置:

log.max-history=10
log.max-size=5MB

同样,对于 http 日志 (http-request.log.XXXX):

  • http-server.log.max-history:要保留的存档文件的最大数量。默认值为 15。
  • http-server.log.max-size:每个文件的最大(未压缩)大小。默认值为 100 MB。
于 2019-03-14T19:25:15.913 回答