How to Configure RHEL Session Logging

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up rhel session logging, admins place a shell wrapper in the login path. This tool reads terminal input and output and sends the text to system logs. Teams often build this setup on each Linux host to track root actions. Still, broad admin roles still let users alter local rules or stop the log process. How rhel session logging works on the host Red Hat includes built-in tools that capture terminal text during a user login. When a person logs in through SSH, the system checks their use

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

To set up rhel session logging, admins place a shell wrapper in the login path. This tool reads terminal input and output and sends the text to system logs. Teams often build this setup on each Linux host to track root actions. Still, broad admin roles still let users alter local rules or stop the log process.

How rhel session logging works on the host

Red Hat includes built-in tools that capture terminal text during a user login. When a person logs in through SSH, the system checks their user profile first. Instead of opening a normal bash shell, the host starts a logging wrapper shell. This wrapper sits between the user and the actual Linux shell on the machine.

Every key the user presses passes through this local wrapper before it runs. The wrapper also reads all text that the shell sends back to the screen. It groups this text into small chunks and writes them to the local journal. From there, a log shipper can send the data to a central server.

Admins can apply this setup to all users or only to specific groups. Many teams link the wrapper to central directory groups so rules follow user roles. You can choose to capture only output, or both user input and screen output. Note that capturing input can place typed passwords into plain text log files.

Where host-level logging falls short at scale

Native host logging solves the basic need to see what happened after an incident. It gives security teams a text trail of commands run inside interactive shells. For a small set of static servers, this built-in tool works well enough. It needs no extra third-party agents since the packages ship with the operating system.

Still, running this setup on the target host itself creates major security gaps. Anyone who gains root privileges on the box can turn off the log service. A privileged user can also edit local files or block the log shipper. Because the control lives inside the machine, a root user can bypass it.

Host wrappers also cannot stop a bad command before the kernel runs it. They only write down the text after the shell executes the action. They do not ask for peer approval when an engineer runs a risky script. Also, they cannot rewrite sensitive output like emails, phone numbers, or card numbers.

SSH Session Logging + Session Binding to Device: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing fleet config and log storage

Keeping local log rules in sync across hundreds of hosts takes steady effort. Each time a team spins up a new node, they must apply the profile. If a build script fails on one host, that machine runs with a blind spot. Audits then require checking every single server to prove the wrapper is active.

Terminal output also creates a huge volume of text data very fast. Programs that redraw the screen generate megabytes of log chunks in minutes. Teams must tune buffer sizes on every host so disks do not fill up. If the local disk fills, the system may drop logs or block new logins.

Viewing these logs later can also slow down an incident review. The native tool splits one long terminal session into many small log entries. To read the full timeline, an admin must query and join those pieces together. Searching for a single command across thousands of split entries takes extra time.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

Before a query runs, hoop.dev guardrails check the statement against your rules, an AI Analyzer you configure can score intent or hold risky calls for human approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does native RHEL logging capture non-interactive commands?

The standard terminal wrapper only captures activity inside an interactive login shell. If a user runs a single command over SSH without a shell, it skips the wrapper. Teams must add separate kernel audit rules to track those direct command runs.

Can a root user bypass local RHEL logging?

Yes, a user with full root rights on the host can bypass local logging. They can kill the log daemon, edit the shell profile, or clear local files. Sending logs to a remote server helps, but root can still block network traffic.

How do you keep typed passwords out of terminal logs?

To avoid logging secret keys, admins usually turn off keystroke input logging on the host. They record only the screen output, since password prompts hide the typed characters. Still, secrets printed to the screen will still end up in the raw log.

The query runs. The emails stay hidden.