kafbat/ui-docs

Document how swap to structured logging

Open

#64 opened on Aug 5, 2025

 (1 comment) (0 reactions) (0 assignees) (41 forks)auto 404
good first issue

Repository metrics

Stars
 (6 stars)
PR merge metrics
 (PR metrics pending)

Description

Summary

Please add official guidance (and example configuration) for turning on structured, machine-readable logging in Kafka-UI. JSON logs are easier to ingest and query in modern observability stacks.

Note:

There is probably a better way to do this if the logback-spring.xml did not exist, as the default spring-boot framework has some good inbuilt default that could be controlled just via config.

You could likely even maintain current behaviour defaulting logging.pattern.console to %black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%c{1}): %msg%n%throwable

Motivation / use-case

  • Teams using tools such as Loki, Elastic, Datadog, or CloudWatch Logs benefit from consistent JSON output.
  • Clear documentation would remove trial-and-error for newcomers and promote best-practice adoption.

Example working setup

Below is a minimal configuration that produces JSON logs at INFO level. It can be included as an example or starting point in the docs.

FROM ghcr.io/kafbat/kafka-ui:v1.2.0

# Copy the custom config file
COPY config.yaml /opt/config.yaml

# Copy the custom Logback file
COPY logback-spring.xml /opt/logback-spring.xml
...
logging:
  config: /opt/logback-spring.xml

  structured:
    format:
      console: logstash

  level:
    org.springframework.security: INFO
    io.kafbat.ui.service.rbac: INFO
...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
      <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <level>${CONSOLE_LOG_THRESHOLD}</level>
      </filter>
      <encoder class="org.springframework.boot.logging.logback.StructuredLogEncoder">
        <format>${CONSOLE_LOG_STRUCTURED_FORMAT}</format>
        <charset>${CONSOLE_LOG_CHARSET}</charset>
      </encoder>
    </appender>

    <root level="INFO">
      <appender-ref ref="CONSOLE"/>
    </root>

</configuration>

References

Contributor guide