#117 View Log Information for a Specific Service
Closed 5 years ago by hhlp. Opened 5 years ago by hhlp.
Unknown source master  into  master

@@ -1,27 +1,11 @@

- [id='viewing-logs']

- = Viewing logs

+ Fedora uses systemd which provides the journalctl tool to view various logs generated by system commands.

  

- 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.

- 

- [id='locating-log-files']

- == 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.

  

  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:

  

  * The command line

  

- * A GUI application

+ * A GUI applications

@@ -1,8 +1,20 @@

- 

  [id='using-GUI-to-view-log-files']

- === Using GUI to view log files

+ = Using GUI to view log files

+ 

+ To view log files in GUI, use the `GNOME Logs` application. `GNOME Logs` is not installed by default. 

+    

+ * Install Via GUI :

+ 

+ ** 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 :

  

- 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.

+ ----

+ $ sudo dnf install gnome-Logs

+ ----

  

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

  

@@ -1,15 +1,15 @@

  [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:

  

  * 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 any kind of CLI/GUI editor.

  

  [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:

  ----
@@ -26,20 +26,40 @@

  $ 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, With one match specified, all entries with a field matching the expression are shown:

  ----

- $ man journalctl

+ $ journalctl _SYSTEMD_UNIT=foo

  ----

  

- [id='using-the-command-line-to-open-log-files-in-text-editor']

- ==== Using the command line to open log files in a text editor

+ * To view, If two different fields are matched, only entries matching both expressions at the same time are shown:

+ ----

+ $ journalctl _SYSTEMD_UNIT=foo _PID=number

+ ----

  

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

+ * To view If two matches refer to the same field, all entries matching either expression are shown:

  ----

- $ nano <logfilename>

+ $ journalctl _SYSTEMD_UNIT=foo _SYSTEMD_UNIT=foo1

  ----

  

- If the root permissions are required:

+ * 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):

  ----

- $ sudo nano <logfilename>

+ $ journalctl _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>>

+ 

+ WARNING: In all previous command you can use The -b and --list-boots options, Otherwise, *journalctl* matches from all the logs, which isn't usually useful and not only for the current boot.

+ 

+ * For more information on *journalctl*, read the man page:

+ ----

+ $ man journalctl

+ ----

+ 

+ [id='using-the-command-line-to-open-log-files-in-text-editor']

+ == Using the command line to open log files in a text editor

+ 

+ All logs are plain text. To open it,you can use your favourite text editor (nano/pico/vim/emacs/gedit/..) to view them.

+ 

@@ -1,13 +1,13 @@

  ifdef::context[:parent-context: {context}]

  :context: viewing-logs

- 

+  

  = Viewing logs in Fedora

- 

+  

  include::{partialsdir}/con_viewing-logs.adoc[leveloffset=+1]

- 

+  

  include::{partialsdir}/proc_log-files-command-line.adoc[leveloffset=+1]

- 

+  

  include::{partialsdir}/proc_log-files-GUI.adoc[leveloffset=+1]

- 

+  

  ifdef::parent-context[:context: {parent-context}]

  ifndef::parent-context[:!context:]

https://pagure.io/fedora-docs/quick-docs/issue/107

  • 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

Could you remove the bits about using rsyslog? It isn't installed by default: https://fedoraproject.org/wiki/Features/systemd-journal

I'd stick to journalctl only, and the GUI tool that we have for it. Since log files aren't saved in general either, the bits about using head etc., should be moved to the bottom as supplementary information maybe? What do you think?

Metadata Update from @jflory7:
- Pull-request tagged with: improvement, needs changes

5 years ago

1 new commit added

  • Review and re-structure View Log Information
5 years ago

Reviwed and re-structure view logs information :

  • remove rssylog from the beginnig add it to bootm as a reference
  • disgregate === Using GUI to view log files using GUI and CLI and add iot how to install via CLI
  • add additional lines to proc_log-files-command-line.adoc
  • add proc_log-files-rsyslog.adoc as new page and reference it in viewing-logs.adoc

Is this section required? There is no text between the title and this, so this is extra. If we remove this, all the following sections can be moved up one level. What do you think @hhlp?

Do you think a bit of context here would help? Something like "Fedora uses systemd which provides the journalctl tool to view various logs generated by system commands."?

pretty please pagure-ci rebuild

5 years ago

Maybe we don't need this bit? It gives the user the impression that only nano should be used, which is contradictory to the top level statement
that all logs are plain text. I suggest we leave it at "All logs are plain text. You can use your favourite text editor (nano/pico/vim/emacs/gedit/..) to view them."
What do you think?

Does rsyslog need to be enabled using systemd or something? I wouldnt' mind removing it from here completely.
I would expect users that want to use it to be sys-admins who probably already know how to go about this?

Do you think we ought to mention the -b and --list-boots options? Otherwise, journalctl matches from all the logs (right?) which isnt usually useful.
We could modify all these commands to include -b to only show information from the current boot?

1 new commit added

  • Make Adjust for Request and re-structure View Log Information
5 years ago

make changes to adjust to your needs :

  • Move sections can be moved up one level
  • Improve con_viewing-logs.adoc with adding some usefull information
  • Change nano with "All logs are plain text. You can use your favourite text editor (nano/pico/vim/emacs/gedit/..) to view them." as you sugested
  • remove rsyslog as your need's
  • ADD a warning with -b --list-boots if the user needs flter log messages for the current boot

Pull-Request has been closed by hhlp

5 years ago

@hhlp Why did you close the PR? Was that by accident?

@pbokoc , No I just not follow the best procedure to work with GIT and Pagure, now I follow the instruction in Pagure....

One ankur review the changes, I will open a pull request again about this topic....

Regards.,