Keycloak Log File Location

Published
Length
3 min read

Luis Felipe Dias

All posts

You can find the keycloak log file location inside the server runtime folder. By default, the system sends output to the console or a local data directory. Teams often set up central log tools to read these files for security checks. Still, broad server roles let too many people read or alter those local files. Overly broad roles also fail to show what users do after they log in. How the keycloak log file location works Keycloak writes two main types of output during a normal run. It records

Keycloak + Log Aggregation & Correlation: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You can find the keycloak log file location inside the server runtime folder. By default, the system sends output to the console or a local data directory. Teams often set up central log tools to read these files for security checks. Still, broad server roles let too many people read or alter those local files. Overly broad roles also fail to show what users do after they log in.

How the keycloak log file location works

Keycloak writes two main types of output during a normal run. It records system events, startup steps, and runtime errors in the main server log. It also tracks login tries, password resets, and admin changes as distinct audit events. Where these files live depends on how your team runs the software.

When you run the server in a container, it sends logs to standard output. Your container runtime catches this stream and saves it on the host machine. When you run the software on a virtual machine, it writes to disk. The process places the output inside a log folder under the main install directory.

Admins can change the output path through startup settings before the service begins. They can turn on file output and set a custom path on the disk. They can also set size limits so the server rotates old files out. Most teams forward these files to a central log platform for long term storage.

What identity logs solve and what they miss

Reading output from the keycloak log file location solves a key identity problem. It tells your security team who tried to log in and when it happened. You can spot brute force attacks, failed token checks, and odd admin changes fast. Auditors need this record to prove that only real users enter your apps.

Yet this setup leaves a major gap in your daily operations. Identity logs only prove that a user passed the front door at login time. They do not record what that user does inside a database or server later. Once the identity server hands out a token, its job and visibility end.

A developer might log in with valid single sign-on credentials in the morning. That person can then run a bad query or read raw customer card numbers. The identity log will show a clean login, while the real damage stays hidden. Teams also struggle when engineers need direct host roles just to read log files. Giving out host keys to check logs creates new security risks across your fleet.

Keycloak + Log Aggregation & Correlation: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing log storage and audit events

To keep your identity records safe, you must separate system errors from user events. System logs help engineers fix broken startups, memory limits, or slow network calls. User and admin events belong in a dedicated audit stream that nobody can edit. By default, the server does not save every user login event to disk.

You have to turn on event listeners in the admin console to capture logins. Once active, the server writes each login and role change to the output stream. Make sure your disk has enough space before you turn on full event logging. High login traffic can fill up a local disk fast and crash the service.

Send these event streams off the host machine as soon as they happen. Storing logs only on the local disk makes investigations slow and risky. Central log tools let your team search login history without touching the live server. Still, to see actual queries and commands, you must look past the identity server.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Where does Keycloak write logs in a container setup?

In a container setup, the server writes all output to standard output by default. It does not save log files inside the container folder unless you enable file logging.

How do I turn on user login logs in Keycloak?

Open the admin console, pick your realm, and open the realm events settings page. Turn on the save events switch for both user actions and admin actions.

Why do my Keycloak logs miss database queries?

Keycloak only manages identity checks and hands out login tokens to users and apps. It never sits in the path of your database traffic or server shell commands.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.