Search code examples
linuxprestotrino

How to purge the Presto logs by configuration?


Dear friends and collegs

we installed before one month the preso cluster

we are very surprised about the logs from presto

we see that logs are not purged from /home/presto/data/var/log

so logs increase the use size on the disk each week

for now all logs are around ~100M and on the next month it will 200M

and we not found how to purge the old logs , or maybe we miss something

of course we can use simple delete syntax as

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

but this workaround should be the latest solution

-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

Solution

  • You can configure log retention of server logs (server.log.XXXX) by setting the following options in the server config.properties file (https://trino.io/docs/current/installation/deployment.html#config-properties):

    • log.max-history: maximum number of archive files to keep. The default value is 30.
    • log.max-size: max (uncompressed) size for each file. The default value is 100 MB.

    For example, if you wanted to keep only 10 files of no more that 5MB (uncompressed) each, you'd set:

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

    Similarly, for the http logs (http-request.log.XXXX):

    • http-server.log.max-history: maximum number of archive files to keep. The default value is 15.
    • http-server.log.max-size: max (uncompressed) size for each file. The default value is 100 MB.