LinuxCommandLibrary

logread

Read system log files

TLDR

Print the log

$ logread
copy

Print n messages
$ logread -l [n]
copy

Filter messages by (Keyword/regex)
$ logread -e [pattern]
copy

Print log messages as they happen
$ logread -f
copy

Display help
$ logread -h
copy

SYNOPSIS

logread [options]
logread [-f] [-e <pattern>] [-r]

PARAMETERS

-f
    Follow log output. logread will not terminate after printing the current log, but wait for new messages and print them as they arrive.

-e <pattern>
    Filter log output by a regular expression pattern. Only messages matching the pattern will be displayed.

-r
    Reverse output order. Prints the newest messages first.

-l <count>
    Limit output to the last count messages.

-h
    Help. Displays a help message and exits.

DESCRIPTION

logread is a lightweight utility primarily used on embedded Linux systems, such as OpenWrt, to access and display kernel and system log messages.

Unlike more complex logging daemons like syslogd or journalctl, logread often reads directly from a circular buffer in memory (like /dev/kmsg) or a small persistent file, making it suitable for devices with limited storage and processing power. It provides a simple way to view recent system events, errors, and informational messages, which is crucial for debugging and monitoring device health without requiring a full-fledged logging infrastructure. Its simplicity means it typically lacks advanced filtering, persistence, or remote logging capabilities found in more comprehensive logging solutions.

CAVEATS

logread is typically very basic. It might not support advanced filtering, long-term persistence, or remote logging.

Log storage is often a circular buffer in RAM, meaning logs are lost on reboot and have a limited history.

Availability: Primarily found on embedded systems (e.g., OpenWrt) and not commonly part of standard desktop/server Linux distributions.

HISTORY

logread emerged as a minimalist logging solution for environments with severe resource constraints, particularly in the embedded Linux space (e.g., OpenWrt). Its development was driven by the need for a simple, low-overhead way to view system events without the memory and storage footprint of traditional syslog implementations. It often works in conjunction with busybox, which provides many common Unix utilities in a single executable, further emphasizing its lightweight nature. Its evolution has focused on efficiency and simplicity rather than feature expansion.

SEE ALSO

dmesg(1), syslogd(8), rsyslogd(8), syslog-ng(8), journalctl(1), tail(1)

Copied to clipboard