Review "view logs on Fedora" quick-doc

- Remove Caution
- Review and Check View Log Information via Systemctl
- Add Using journalctl to View Log Information for a Specific Service
- Add to know more about systemd -> understanding-and-administering-systemd
- Sections can be moved up one level replaceing rsyslog
- Improve con_viewing-logs.adoc with adding some usefull information
- Change in using nano and vim to you can use favourite text editor
- Remove rsyslog completly
- Add -b and --list-boots if the user needs flter log messages for the current boot or view old log's
- instead of using bold for commands and file/folder names, maybe make them monospace too. That does'nt work in _NOTE_
- "Using the command line to open log files in a text editor" -> "Use a text editor" as a separate section.
- Observe a Warning when editing view_log.adoc and there is a PR in ASCCIDOCTOR
https://github.com/asciidoctor/asciidoctor/issues/2855.

[Ticket: 107] - https://pagure.io/fedora-docs/quick-docs/issue/107
This commit is contained in:
hector louzao 2019-03-28 13:17:36 +01:00 committed by Ankur Sinha (Ankur Sinha Gmail)
parent c89d3b7d73
commit ef70ecd8f2
No known key found for this signature in database
GPG key ID: F8D8C0BEBAC898BD
4 changed files with 95 additions and 48 deletions

View file

@ -1,27 +1,14 @@
[id='viewing-logs'] [id='viewing-logs in Fedora']
= Viewing logs = Viewing logs in Fedora
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. Fedora uses systemd which provides the journalctl tool to view various logs generated by system commands.
[id='locating-log-files'] 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, this is an important task when you try to find any class of problem in your system and help you to resolve any issue.
== Locating log files
Most log files are located in the `/var/log/` directory. 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
----
[id='viewing-log-files']
== Viewing log files
In Fedora, there are two ways to open the log files: In Fedora, there are two ways to open the log files:
* The command line * The command line
* A GUI application * A GUI applications

View file

@ -1,13 +1,25 @@
[id='using-gnome-logs-to-view-log-files']
= Using Gnome Logs to view log files
[id='using-GUI-to-view-log-files'] To view log files in GUI, use the `GNOME Logs` application. `GNOME Logs` is not installed by default.
=== Using GUI to view log files
* Install Via GUI :
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. ** Press the `Super` key
** Type `Software`
** In the `Search` field type `Logs` and choose the `GNOME Logs` item from the list of results
** Install the application
* Install Via Command Line :
----
$ sudo dnf install gnome-Logs
----
In `GNOME Logs`, you can filter for time periods, search within logs, and display categories. 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 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 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. * To search within logs, select a log file from the results pane.
. Click the search icon. . Click the search icon.
. Enter one or more search criterion in the search field. . Enter one or more search criterion in the search field.

View file

@ -1,22 +1,22 @@
[id='using-the-command-line-to-view-log-files] [id='using-the-command-line-to-view-log-files]
=== Using the command line to view log files = Using the command line to view log files
You can use the command line to view logs in different ways, for example: You can use the command line to view logs in different ways, for example:
* Using the *journalctl* command * Using the `*Journalctl*` command
* Using the commands for viewing, for example *cat*, *more*, *less*, *tail*, or *head* * Using the commands for viewing, for example `*cat*`, `*more*`, `*less*`, `*tail*`, or `*head*`
* Combine the commands for viewing with the *grep* command * Combine the commands for viewing with the `*grep*` command
* Using a text editor, for example, `nano` or `vim` * Using any kind of CLI/GUI editor.
[id='using-journalctl-to-view-system-information'] [id='using-journalctl-to-view-system-information']
==== Using journalctl to view system information. == Using journalctl to view system information.
* To view all collected logs with no filter: * To view all collected logs with no filter:
---- ----
$ journalctl $ 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`: * 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 $ journalctl /dev/sda
---- ----
@ -26,20 +26,72 @@ $ journalctl /dev/sda
$ journalctl -k -b -1 $ journalctl -k -b -1
---- ----
* For more information on *journalctl*, read the man page: [id='using-journalctl-to-view-log-information-for-a-specific-service']
== Using Journalctl to View Log Information for a Specific Service
* To view the current Boot log use the `-b` option :
* To view, With one match specified, all entries with a field matching the expression are shown:
----
$ journalctl -b _SYSTEMD_UNIT=foo
----
* To view, If two different fields are matched, only entries matching both expressions at the same time are shown:
----
$ journalctl -b _SYSTEMD_UNIT=foo _PID=number
----
* To view If two matches refer to the same field, all entries matching either expression are shown:
----
$ journalctl -b _SYSTEMD_UNIT=foo _SYSTEMD_UNIT=foo1
----
* To view, If the separator "+" is used, two expressions may be combined in a logical OR. The following will show all messages from the `*foo*` service process with the `*PID*` plus all messages from the `*foo1*` service (from any of its processes):
----
$ journalctl -b _SYSTEMD_UNIT=foo _PID=number + _SYSTEMD_UNIT=foo1
----
NOTE: The files for service modification are stored in a directory within `*/etc/systemd/system*`, to know more about systemd <<understanding-and-administering-systemd.adoc#,Understanding Systemd Services>>
[id='Using-journalctl-to-view-older-logs']
== Using Journalctl to View Older Logs
* To view older logs use the `--list-boots` option :
Show a tabular list of boot numbers, their IDs, and the timestamps of the first and last message pertaining to the boot.
Example :
----
$ journalctl --list-boots
-8 42cdeac65d494e938b9cb92f315b08a4 Mon 2018-11-12 10:36:42 CET—Mon 2018-11-12 20:08:24 CET
-7 c110d2b8705345b786fe310de628bfc7 Tue 2018-11-13 10:29:27 CET—Tue 2018-11-13 10:04:00 CET
----
with this ID you can use `*journalctl*` as usual :
----
$ journalctl --boot=ID _SYSTEMD_UNIT=foo
----
* To know more about `*journalctl*`, read the man page:
---- ----
$ man journalctl $ man journalctl
---- ----
[id='using-the-command-line-to-open-log-files-in-text-editor'] [id='using-any-kind-CLI/GUI-editor-for-view-logs']
==== Using the command line to open log files in a text editor == Using any kind of CLI/GUI editor for View-Logs
All log files are in plain text. To open a log file in a text editor, enter the following command: All logs are plain text, so you can use diferent utils to view them.
----
$ nano <logfilename>
----
If the root permissions are required: [id='using-CLI-editor-in-Terminal']
---- === Using any CLI editor in Terminal
$ sudo nano <logfilename>
---- * To open, Just use (nano/pico/vim/nvim/emacs) for name a few.
[id='using-GUI-editor-in-terminal']
=== Using any GUI editor in Terminal
* To open, Just use (gvim/gedit/geany) for name a few.
NOTE: Both method usually requires `*sudo*` access.

View file

@ -1,15 +1,11 @@
ifdef::context[:parent-context: {context}] ifdef::context[:parent-context: {context}]
:context: viewing-logs :context: viewing-logs
= Viewing logs in Fedora
include::{partialsdir}/unreviewed-message.adoc[]
include::{partialsdir}/con_viewing-logs.adoc[leveloffset=+1] include::{partialsdir}/con_viewing-logs.adoc[leveloffset=+1]
include::{partialsdir}/proc_log-files-command-line.adoc[leveloffset=+1] include::{partialsdir}/proc_log-files-command-line.adoc[leveloffset=+1]
include::{partialsdir}/proc_log-files-GUI.adoc[leveloffset=+1] include::{partialsdir}/proc_log-files-GUI.adoc[leveloffset=+1]
ifdef::parent-context[:context: {parent-context}] ifdef::parent-context[:context: {parent-context}]
ifndef::parent-context[:!context:] ifndef::parent-context[:!context:]