Viewing logs in Fedora

    System tools that do not use systemd for their logs continue to place them as plain text files in the /var/log/ directory. In Fedora, there are two ways of accessing system logs:

    • The command line

    • A GUI applications

    The journalctl command can be to view messages in the system journal on the command line. For plain text log files, generic tools may be used:

    • cat, more, less, tail, or head.

    • the grep command to search for specific information.

    • any text editor of your choosing (nano/pico/vim/emacs)

    • To view all collected journal entries, simply use:
    • To view a logs related to a specific file, you can provide the journalctl command with a filepath. The example shown below shows all logs of the kernel device node /dev/sda:
      • To view log for the current boot use the -b option :
      1. $ journalctl -b
      • To view kernel logs for the current boot, you can add the option:
      1. $ journalctl -k -b -1
      • To filter logs to only see ones matching the “foo” systemd service:
      • Matches can be combined. For example, to view logs for systemd-units that match foo, and the PID number:
      1. $ journalctl -b _SYSTEMD_UNIT=foo _PID=number
      • If the separator “+” is used, two expressions may be combined in a logical OR. For example, to view all messages from the foo service process with the PID plus all messages from the foo1 service (from any of its processes):
      1. $ journalctl -b _SYSTEMD_UNIT=foo _PID=number + _SYSTEMD_UNIT=foo1
      • If two matches refer to the same field, all entries matching either expression are shown. For example, this command will show logs matching a systemd-unit foo or a systemd-unit foo1:
      1. $ journalctl -b _SYSTEMD_UNIT=foo _SYSTEMD_UNIT=foo1
      • To view older logs use the --list-boots option :

      This will show a tabular list of boot numbers, their IDs, and the timestamps of the first and last message pertaining to the boot:

      with this ID you can use journalctl as usual :

        • To know more about journalctl, read the man page:
        1. $ man journalctl

        Using Gnome Logs to view log files

        The GNOME Logs application provides a convenient GUI tool to view the systemd journal. GNOME Logs is not currently installed by default on Fedora systems.

        • You can install Gnome Logs using the default software installation application on your system. On a Fedora Workstation install running the GNOME desktop:

          • Press the Super key

          • Type Software

          • In the Search field type Logs and choose the GNOME Logs item from the list of results

        • You can also install GNOME Logs using the command line with dnf:

        1. $ sudo dnf install gnome-logs

        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 , and select a time period.

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

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