Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk9 min

How to View and Configure Linux Logs on Ubuntu, Debian and CentOS

A command-first guide to viewing Linux logs with journalctl and traditional /var/log files, comparing Ubuntu, Debian and CentOS, enabling persistent journals, configuring rsyslog, and fixing missing logs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use journalctl first on a modern Ubuntu, Debian, or CentOS/RHEL-family system: systemd-journald collects kernel, boot, service, and application messages in a structured journal. Also inspect /var/log, because rsyslog and individual applications may write traditional text files there. The commands below show how to find current and previous-boot events, follow a service live, make journals survive reboot, route messages to files, and diagnose empty or inaccessible logs.

Quick command reference

Run these commands from a shell. Most system and security logs require sudo; access is also controlled by systemd-journal groups and file permissions.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Need Command What it shows
All journal entries sudo journalctl Systemd journal entries in chronological order.
Current boot sudo journalctl -b Messages collected since the machine last booted.
List boots sudo journalctl --list-boots Boot IDs, offsets, and start/end times available to the journal.
Previous boot sudo journalctl -b -1 Entries from the boot immediately before the current one. Use a boot ID from --list-boots when needed.
One service sudo journalctl -u ssh.service Entries associated with the named systemd unit; replace it with the real unit name.
Follow a service sudo journalctl -u ssh.service -f Prints new entries as the service writes them.
Kernel messages sudo journalctl -k Kernel messages in the journal.
Recent text-file lines sudo tail -n 100 /var/log/syslog The last 100 lines of a traditional file.
Follow a text file sudo tail -f /var/log/syslog New lines appended to that file.
Search a text file sudo grep -i 'error|fail|warning' /var/log/syslog Case-insensitive matches for common failure words.

If a unit name is unknown, list installed units with your distribution’s normal systemd tooling or inspect the service’s package documentation; do not assume that every daemon uses ssh.service.

How Linux logging is organized

systemd-journald and the journal

systemd-journald is a system service that collects kernel messages, early-boot output, messages sent through the libc syslog interface, native Journal API records, service standard output and error, and audit records. It stores structured binary data rather than one plain-text file. journalctl is the supported query interface, so filters by boot, unit, or kernel source remain useful even when no obvious file exists under /var/log.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Journal storage has two locations. Persistent data is normally below /var/log/journal; volatile data is below /run/log/journal. The latter is a runtime filesystem and is cleared during reboot. The Storage= setting in /etc/systemd/journald.conf controls the policy, subject to the distribution’s defaults and available directories.

Traditional files and rsyslog

Many installations also run rsyslog. Journald can forward messages to rsyslog, which classifies them and writes text files under /var/log. Applications may bypass both services and create their own files, as web servers commonly do. Therefore an empty /var/log/syslog does not prove that the system has no logs: the journal may contain the records, rsyslog may not be installed, or the application may use a different path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where common files are on each distribution

File names are conventions, not guarantees. A minimal image, container, desktop installation, or customized rsyslog policy can omit them. Check the journal and the active configuration on the host you are administering.

Distribution family Primary query interface Common traditional files Typical rsyslog situation Persistence policy Package manager
Ubuntu journalctl /var/log/auth.log (authorization, password prompts, sudo, remote logins); /var/log/kern.log (kernel); /var/log/syslog (general system information). Apache commonly uses /var/log/apache2/access.log and error.log. Often present and configured to route messages to files, but installation and rules vary. Depends on whether /var/log/journal exists and on Storage=. apt
Debian journalctl; journalctl -b --system is documented for system and kernel records. Frequently includes /var/log/syslog, /var/log/auth.log, and /var/log/kern.log when rsyslog rules provide them. May be installed or absent depending on the system profile; inspect /etc/rsyslog.conf and /etc/rsyslog.d/. Journald writes persistent binary data below /var/log/journal or volatile data below /run/log/journal. apt
CentOS/RHEL family journalctl /var/log/messages, /var/log/secure, /var/log/maillog, /var/log/cron, and /var/log/boot.log are common. RHEL documentation describes journald collecting records and forwarding them to rsyslog, which sorts and writes files under /var/log; local policy can differ. Check the journal directory and active journald limits rather than assuming previous boots are available. dnf

View logs step by step

Inspect the current boot

  1. Start with sudo journalctl -b. Page through output with the terminal pager and use its search facility to locate a timestamp, hostname, process, or error.
  2. For only kernel activity, run sudo journalctl -k. If you need the system scope explicitly on Debian, use sudo journalctl -b --system.
  3. For a daemon, substitute its exact unit: sudo journalctl -u ssh.service. A unit can have a different name, such as a templated instance or a distribution-specific spelling.
  4. To watch a restart, open a second terminal and run sudo journalctl -u ssh.service -f, then restart or exercise the service. Stop following with Ctrl+C.

Inspect an earlier boot

  1. Run sudo journalctl --list-boots. The output shows an offset such as 0 for the current boot, negative offsets for earlier boots, and a boot ID.
  2. Query the immediately previous boot with sudo journalctl -b -1.
  3. If several boots are listed, use the displayed boot ID with sudo journalctl -b BOOT_ID (replace BOOT_ID with the actual value). If no earlier boot appears, the journal is probably volatile, has already rotated those entries, or has insufficient permissions.

Read traditional files

Use less when you need to page through a file without loading it all into an editor:

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
sudo less /var/log/syslog
sudo less /var/log/messages
sudo less /var/log/auth.log
sudo less /var/log/secure

Choose the file that exists on the target distribution. Follow a busy file with sudo tail -f /var/log/syslog, or show a bounded sample with sudo tail -n 100 /var/log/syslog. Search without opening an editor using sudo grep -i 'error|fail|warning' /var/log/syslog. If rotation has occurred, related files may have numeric or compressed suffixes; inspect the directory and the distribution’s rotation configuration before assuming data is missing.

Use the Ubuntu graphical viewer

On Ubuntu desktop, GNOME Logs can display, monitor, search, open, and close log files. It is a convenient front end for users who do not need a shell, but permissions and retention are still governed by journald, rsyslog, and the files themselves.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make journald logs survive a reboot

Do not promise a fixed number of days unless you have checked the active release’s limits. Journald can rotate according to settings such as SystemMaxUse=, RuntimeMaxUse=, and MaxRetentionSec=; available disk space and distribution defaults also matter.

Enable a persistent journal with the default policy

  1. Create the persistent directory:
    sudo mkdir -p /var/log/journal
  2. Apply systemd’s expected ownership and mode:
    sudo systemd-tmpfiles --create --prefix /var/log/journal
  3. Flush records that may currently be in the runtime journal:
    sudo journalctl --flush
  4. Confirm that journald is using disk space and can answer a query:
    sudo journalctl --disk-usage
    sudo journalctl -b

This procedure creates persistent storage without replacing the distribution’s complete configuration. If you need an explicit policy, edit /etc/systemd/journald.conf and set Storage=persistent. After changing it, apply the configuration with:

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
sudo systemctl restart systemd-journald

Run sudo journalctl --disk-usage and a test query afterward. Keep an eye on disk usage and set appropriate size or retention limits for the release; unlimited growth is not a safe assumption.

Why previous boots are still unavailable

  • The directory is absent: only /run/log/journal was used, so reboot removed the old data.
  • Limits removed old files: journald rotated entries to stay within configured size or time limits.
  • The query is too broad or the unit is wrong: verify boot IDs with --list-boots and the exact unit name.
  • Access is restricted: retry with sudo or have an administrator grant appropriate system-journal access.

Install and configure rsyslog routing

Use rsyslog when you need traditional text files, compatibility with existing monitoring, or forwarding rules. Do not overwrite a distribution’s main configuration casually. Put local rules in /etc/rsyslog.d/*.conf so package updates and vendor defaults remain easier to manage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install and enable the service

Ubuntu or Debian:
sudo apt update && sudo apt install rsyslog

CentOS or RHEL family:
sudo dnf install rsyslog

Enable and start:
sudo systemctl enable --now rsyslog

Some systems already have rsyslog enabled. Installing it again is unnecessary; check its status before changing files.

Add a minimal local route

The following inputs accept local socket and kernel messages and write them to a file. Place the rule in a file such as /etc/rsyslog.d/10-local.conf rather than replacing /etc/rsyslog.conf:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
module(load="imuxsock")
module(load="imklog")
action(type="omfile" file="/var/log/syslog")

Choose a path and permissions appropriate for the sensitivity of the messages. Existing vendor rules may already write the same events, so inspect the active configuration to avoid duplicate lines or unexpected volume.

Validate before restarting

  1. Check syntax without disrupting the running daemon:
    sudo rsyslogd -N1
  2. Fix every reported error before proceeding. Common causes include an unmatched quote, an invalid module name, a directory that does not exist, or permissions that prevent opening the destination.
  3. Restart only after validation:
    sudo systemctl restart rsyslog
  4. Generate a harmless test message and inspect the destination:
    logger -t logtest 'hello'
    sudo tail -n 20 /var/log/syslog

    On a CentOS/RHEL-style route, check the configured /var/log/messages file instead.

Ensure custom directories exist and are writable by the rsyslog process while remaining protected from untrusted users. A syntactically valid rule can still fail at runtime if its path, ownership, or mandatory access-control policy is wrong.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Rotation, retention, and permissions

Traditional files

Distribution logrotate policies normally manage text files. Inspect /etc/logrotate.conf and /etc/logrotate.d/ on the host to learn the actual schedule, compression, post-rotate actions, and retention. Those values are release- and administrator-specific; do not infer them from a different Ubuntu, Debian, or CentOS installation.

Journal files

Journald rotates its own files and enforces its configured size and time controls. Review the active journald configuration, including system and runtime limits, before setting operational expectations. sudo journalctl --disk-usage reports current journal consumption.

Protect sensitive records

Authentication, authorization, audit, and service logs can contain usernames, hostnames, IP addresses, command lines, tokens, or other sensitive data. Restrict read access, use sudo only when necessary, and redact secrets before sending excerpts to a ticket or chat. Membership in a system-journal group can grant broad read access, so treat that membership as privileged.

Troubleshooting missing or empty logs

/var/log/syslog or /var/log/messages is empty or absent

  • Query sudo journalctl -b first. Journald may be collecting everything while rsyslog is not installed or not routing to that filename.
  • Check whether rsyslog is installed and running: sudo systemctl status rsyslog.
  • Inspect /etc/rsyslog.conf and /etc/rsyslog.d/ for an active rule targeting the file you expect.
  • Run sudo rsyslogd -N1 before any restart. Correct syntax and destination permissions, then restart and test with logger.

Previous boots do not appear

Run sudo journalctl --list-boots. If only offset 0 is present and /var/log/journal does not exist, the host was likely using volatile storage. Create the directory, run systemd-tmpfiles --create --prefix /var/log/journal, flush with journalctl --flush, and verify. This cannot recover entries that were already discarded during earlier reboots.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The service query returns nothing

Confirm the unit spelling and whether the service actually uses systemd. A program launched manually, inside a container, or under a supervisor may log elsewhere. Query the general current-boot journal, then identify the service’s real unit before repeating journalctl -u.

You receive permission errors

Retry with sudo when policy permits. For regular, non-root access, ask an administrator to configure the appropriate system-journal group or file ACL rather than making logs world-readable. Text files can have different ownership and mode from the journal, so access to one does not imply access to the other.

Rsyslog fails after a configuration change

Use sudo rsyslogd -N1 to locate syntax errors, then inspect service status and the journal for startup diagnostics. Restore the last known-good snippet if necessary, correct module or action parameters, create missing destination directories, verify ownership, and restart only after the check passes. Keep local changes in a separate /etc/rsyslog.d/ file so rollback is straightforward.

A practical investigation workflow

  1. Record the incident time and affected host, then run sudo journalctl -b to establish what the current boot saw.
  2. Search the relevant unit with sudo journalctl -u UNIT -f while reproducing the problem.
  3. Separate kernel symptoms using sudo journalctl -k.
  4. If the event preceded a reboot, inspect sudo journalctl --list-boots and query the appropriate negative boot offset.
  5. Compare the journal with the applicable text file, such as /var/log/auth.log, /var/log/secure, /var/log/syslog, or /var/log/messages.
  6. When a file is missing, determine whether rsyslog is installed, whether its rules route that facility, and whether logrotate moved or compressed older files.
  7. Before changing routing or retention, preserve relevant evidence and note the exact release, configuration file, command output, and time zone.

Defaults differ between releases and installation profiles. Verify the unit names, package availability, active journald settings, rsyslog rules, permissions, and rotation policy on the exact Ubuntu, Debian, or CentOS/RHEL host you maintain.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.