Skip to content

[Server] Default log config keeps only about 5 seconds of server log history #2055

Closed

Description

@yili-db

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 = 5

TimeBasedTriggeringPolicy 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

  1. Start the server with the default config: bin/start-uc-server.
  2. Right after startup, list etc/logs: there are already two server-<date>-<time>-1.log.gz archives, and server.log holds only the last few startup lines.
  3. 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
  4. List etc/logs again: 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:

  1. Roll hourly: drop the minutes and seconds from the date pattern, which keeps interval = 1 but makes it hourly. Putting the date in yyyy-MM-dd order also makes archives sort by name.
    appender.rollingFile.filePattern = etc/logs/server-%d{yyyy-MM-dd-HH}-%i.log.gz
  2. Keep archives by age: replace the two ifAny lines (IfAccumulatedFileCount, which would keep only 5 hours with hourly archives) with an IfLastModified condition, for example 7 days. The IfFileName condition 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: main at 8715cd5, using the default etc/conf/server.log4j2.properties

Additional context

Activity

  1. added
    bug
    on Oct 25, 2026
  2. added a commit that references this issue on Oct 28, 2026
    d2b0a32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions