Repository navigation
Description
Describe the bug
With the shipped etc/conf/server.log4j2.properties, the server rolls etc/logs/server.log into a new .gz archive every second that has log activity, and deletes all but the newest 5 archives. A server that logs steadily therefore keeps only about 5 seconds of history: startup lines are gone a few seconds after startup, and an ERROR line for a failed request is gone a few seconds after it is written.
The cause is the archive name pattern:
appender.rollingFile.filePattern = etc/logs/server-%d{MM-dd-yyyy-HH-mm-ss}-%i.log.gz
appender.rollingFile.policies.time.type = TimeBasedTriggeringPolicy
appender.rollingFile.policies.time.interval = 1
...
appender.rollingFile.strategy.action.ifAny.type = IfAccumulatedFileCount
appender.rollingFile.strategy.action.ifAny.exceeds = 5TimeBasedTriggeringPolicy rolls over based on the most specific time unit in the date pattern, which here is seconds (ss), so interval = 1 means one archive per second. The Delete action then keeps at most 5 archives, regardless of how much time each one covers.
To Reproduce
- Start the server with the default config:
bin/start-uc-server. - Right after startup, list
etc/logs: there are already twoserver-<date>-<time>-1.log.gzarchives, andserver.logholds only the last few startup lines. - Send a request that logs a line once per second for about 10 seconds, for example:
for i in $(seq 1 9); do curl -s -o /dev/null -X POST http://localhost:8080/api/2.1/unity-catalog/models \ -H 'Content-Type: application/json' \ -d "{\"name\":\"m$i\",\"catalog_name\":\"nope\",\"schema_name\":\"s\"}" sleep 1 done
- List
etc/logsagain: the startup archives have been deleted, and the oldest surviving line is from the first request's second.
Observed after step 4:
server-10-25-2026-22-42-50-1.log.gz
server-10-25-2026-22-42-51-1.log.gz
server-10-25-2026-22-42-52-1.log.gz
server-10-25-2026-22-42-53-1.log.gz
server.log
Expected behavior
The default config keeps enough history to investigate a failure after the fact: days, not seconds. Archives roll every hour (and by size within an hour), and retention is counted by age rather than by number of archives.
Two changes:
- Roll hourly: drop the minutes and seconds from the date pattern, which keeps
interval = 1but makes it hourly. Putting the date inyyyy-MM-ddorder also makes archives sort by name.appender.rollingFile.filePattern = etc/logs/server-%d{yyyy-MM-dd-HH}-%i.log.gz - Keep archives by age: replace the two
ifAnylines (IfAccumulatedFileCount, which would keep only 5 hours with hourly archives) with anIfLastModifiedcondition, for example 7 days. TheIfFileNamecondition stays.appender.rollingFile.strategy.action.age.type = IfLastModified appender.rollingFile.strategy.action.age.age = P7D
The 10MB SizeBasedTriggeringPolicy still splits a busy hour into -1, -2, ... archives. strategy.max = 5 caps those per hour, so an hour that logs more than 50MB overwrites its own oldest archive; raising max (for example to 20) avoids that. If disk use matters more than a fixed number of days, an IfAccumulatedFileSize cap can be added alongside the age condition.
System [please complete the following information]:
- OS: Ubuntu (Linux 5.4), JDK 17
- Unity Catalog:
mainat 8715cd5, using the defaultetc/conf/server.log4j2.properties
Additional context
- The Helm chart is not affected: it renders its own log4j2 config with a console appender and no rollover.
- This also undercuts [Server] Log every 5xx with its cause and a request ID #1999, which makes each 5xx log one
ERRORline with its cause and request ID: with the default config, that line can be deleted within seconds. - Replace hardcoded logging config with classpath-based Log4j2 auto-discovery #1406 (for The logging configuration is hardcoded #1407) replaces this config file with a classpath default that rolls on size only. Whichever lands second should carry the hourly rolling and age-based retention over.
Activity
[Server] Keep days of server log history with the default log config (#…