Document how swap to structured logging
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 6
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
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.
Dockerfile
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
config.yaml
...
logging:
config: /opt/logback-spring.xml
structured:
format:
console: logstash
level:
org.springframework.security: INFO
io.kafbat.ui.service.rbac: INFO
...
logback-spring.xml
<?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
- Spring Boot logging guide (structured logging): https://docs.spring.io/spring-boot/3.4-SNAPSHOT/reference/features/logging.html#features.logging.structured
- Default structured-console-appender example: https://github.com/spring-projects/spring-boot/blob/3.4.x/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/structured-console-appender.xml
- Default spring boot logback file https://github.com/spring-projects/spring-boot/blob/3.4.x/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml
- Kafka UI logback file https://github.com/kafbat/kafka-ui/blob/main/api/src/main/resources/logback-spring.xml
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Find the documentation entry point in ui-docs, then review the referenced logback-spring.xml and Spring Boot structured-logging guide. Document the Docker/configuration setup shown in the issue, and consider the existing Kafka UI logging configuration; done means newcomers can enable machine-readable logs from the published guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, spring-boot
- Domain
- documentation, observability
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- Half a day
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100