I have QuestDB running with debug logging enabled and the log file grows very quickly, it adds few GB per day. How can I set it up so that it doesn't keep more than X GB or X days of logs?
I have considered doing a bash script to split the log file but I don't think it's a good idea to try deleting from the file while the DB is writing into it.
You can change logging configuration as described in
https://questdb.io/docs/reference/configuration/#configuration-file
and used LogRollingFileWriter
:
# list of configured writers
writers=file,stdout
# file writer
w.file.class=io.questdb.log.LogRollingFileWriter
w.file.location=log/questdb-debug-info-error.log
w.file.level=DEBUG,INFO,ERROR
w.file.rollSize=100m
This will start rolling log file after every 100 Mb to a new file. You can then automate archiving or deleting unwanted log files.
Rolling can be by size (as above) or by time. To get rolling by day use
w.file.rollEvery=DAY
Day, Month, Year, Hour and Minute values are supported.
This all from here https://github.com/questdb/questdb/blob/master/core/src/main/java/io/questdb/log/LogRollingFileWriter.java, not documented properly