Viewing logs

Log files contain messages about the system, including the kernel, services, and applications running on it. There are different log files for different information. For example, there is a default system log file, a log file for security messages, and a log file for cron tasks.

Locating log files

Most log files are located in the /var/log/ directory.

Rsyslog is a system utility that provides support for logging. To install the rsyslog package:

$ sudo dnf install rsyslog

To view a list of log files maintained by the related daemon, rsyslogd, enter the following command:

$ less /etc/rsyslog.conf

Viewing log files

In Fedora, there are two ways to open the log files:

  • The command line

  • A GUI application

Using the command line to view log files

You can use the command line to view logs in different ways, for example:

  • Using the journalctl command

  • Using the commands for viewing, for example cat, more, less, tail, or head

  • Combine the commands for viewing with the grep command

  • Using a text editor, for example, nano or vim

Using journalctl to view system information.
  • To view all collected logs with no filter:

$ journalctl
  • To view a specific log file, enter the journalctl command with a log filepath. The example command returns all logs of the kernel device node /dev/sda:

$ journalctl /dev/sda
  • To view the boot logs, run the following command:

$ journalctl -k -b -1
  • For more information on journalctl, read the man page:

$ man journalctl
Using the command line to open log files in a text editor

All log files are in plain text. To open a log file in a text editor, enter the following command:

$ nano <logfilename>

If the root permissions are required:

$ sudo nano <logfilename>

Using GUI to view log files

To view log files in GUI, use the GNOME Logs application. GNOME Logs is not installed by default, press the Super key and type Software. In the Search field type Logs and choose the GNOME Logs item from the list of results and install the application.

In GNOME Logs, you can filter for time periods, search within logs, and display categories.

  • To select a log file type, from the side bar of GNOME Logs, select the type to view.

  • To select a time period, from the menu bar, click Logs, and select a time period.

  • To search within logs, select a log file from the results pane.

    1. Click the search icon.

    2. Enter one or more search criterion in the search field.