Skip to content

Logs

Finding out where a server writes its logs, reading kernel messages, writing your own log entries, keeping log files small, tracking failed logins and audit events, and analysing logs quickly.

Basics: Where logs are kept, log levels and log rotation

Kernel and system

  • dmesg


    Kernel messages: hardware, drivers, OOM killer.

  • logger


    Write your own messages into the log.

  • systemd-cat


    Send command output to the journal.

Manage log files

  • logrotate


    Rotate, compress and delete old logs.

Logins

  • faillock


    Failed logins and locked accounts.

Audit

Analyse

  • lnav


    Navigate and filter several logs at once.

  • goaccess


    Analyse web server logs.

From other chapters

  • journalctl


    Read the systemd journal. Covered in the chapter systemd.

  • tail


    Follow log files live with tail -f. Covered in the chapter Viewing files.

  • less


    Browse and search large log files. Covered in the chapter Viewing files.

  • grep


    Filter log lines by a pattern. Covered in the chapter Text processing.

  • last


    Show the login history. Covered in the chapter Orientation.