Change-Id: Ic7babe831f1e265310408b654f7964053738e0f1
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/11284
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Tapas Kundu <tkundu@vmware.com>
| ... | ... |
@@ -232,10 +232,11 @@ |
| 232 | 232 |
- [Permitting Root Login with SSH](photon_troubleshoot/permitting-root-login-with-ssh.md) |
| 233 | 233 |
- [Fixing Sendmail](photon_troubleshoot/fixing-sendmail.md) |
| 234 | 234 |
- [Photon OS General Troubleshooting] (photon_troubleshoot/Photon_OS_General_Troubleshooting.md) |
| 235 |
- - [Package Management](photon_troubleshoot/Troubleshooting_PackageManagement.md) |
|
| 236 |
- - [Network Configurations] (photon_troubleshoot/Troubleshooting_Networkconfiguration.md) |
|
| 237 |
- - [cloud-init] (photon_troubleshoot/Troubleshooting-cloudinit.md) |
|
| 238 |
- - [vmtoolsd] (photon_troubleshoot/Troubleshooting-vmtoolsd) |
|
| 235 |
+ - [Photon Code](Troubleshooting_photoncode.md) |
|
| 236 |
+ - [Package Management](Troubleshooting_PackageManagement.md) |
|
| 237 |
+ - [Network Configurations] (Troubleshooting_Networkconfiguration.md) |
|
| 238 |
+ - [cloud-init] (Troubleshooting-cloudinit.md) |
|
| 239 |
+ - [vmtoolsd] (Troubleshooting-vmtoolsd.md) |
|
| 239 | 240 |
- [Troubleshooting Tools on Photon OS](photon_troubleshoot/troubleshooting-tools.md) |
| 240 | 241 |
- [Common Tools](photon_troubleshoot/common-tools.md) |
| 241 | 242 |
- [Troubleshooting Tools Installed by Default](photon_troubleshoot/default-tools.md) |
| ... | ... |
@@ -269,6 +270,7 @@ |
| 269 | 269 |
- [Investigating Unexpected Behavior](photon_troubleshoot/investigating-strange-behavior.md) |
| 270 | 270 |
- [Investigating the Guest Kernel](photon_troubleshoot/investigating-the-guest-kernel.md) |
| 271 | 271 |
- [Kernel Log Replication with VProbes](photon_troubleshoot/kernel-log-replication-with-vprobes.md) |
| 272 |
+ - [Troubleshooting Linux Kernel](Troubleshooting-linuxkernel.md) |
|
| 272 | 273 |
- [Performance Issues](photon_troubleshoot/performance-issues.md) |
| 273 | 274 |
- [General Guidelines](photon_troubleshoot/general_performance_guidelines.md) |
| 274 | 275 |
- [Throughput Performance](photon_troubleshoot/throughput_performance.md) |
| ... | ... |
@@ -2,6 +2,7 @@ |
| 2 | 2 |
|
| 3 | 3 |
The section includes general troubleshooting instruction for Photon OS. |
| 4 | 4 |
|
| 5 |
+- [Photon Code](Troubleshooting_photoncode.md) |
|
| 5 | 6 |
- [Package Management](Troubleshooting_PackageManagement.md) |
| 6 | 7 |
- [Network Configurations] (Troubleshooting_Networkconfiguration.md) |
| 7 | 8 |
- [cloud-init] (Troubleshooting-cloudinit.md) |
| ... | ... |
@@ -17,10 +17,11 @@ |
| 17 | 17 |
- [Permitting Root Login with SSH](permitting-root-login-with-ssh.md) |
| 18 | 18 |
- [Fixing Sendmail](fixing-sendmail.md) |
| 19 | 19 |
- [Photon OS General Troubleshooting] (Photon_OS_General_Troubleshooting.md) |
| 20 |
+ - [Photon Code](Troubleshooting_photoncode.md) |
|
| 20 | 21 |
- [Package Management](Troubleshooting_PackageManagement.md) |
| 21 | 22 |
- [Network Configurations] (Troubleshooting_Networkconfiguration.md) |
| 22 | 23 |
- [cloud-init] (Troubleshooting-cloudinit.md) |
| 23 |
- - [vmtoolsd] (Troubleshooting-vmtoolsd) |
|
| 24 |
+ - [vmtoolsd] (Troubleshooting-vmtoolsd.md)) |
|
| 24 | 25 |
- [Troubleshooting Tools on Photon OS](troubleshooting-tools.md) |
| 25 | 26 |
- [Common Tools](common-tools.md) |
| 26 | 27 |
- [Troubleshooting Tools Installed by Default](default-tools.md) |
| ... | ... |
@@ -54,6 +55,7 @@ |
| 54 | 54 |
- [Investigating Unexpected Behavior](investigating-strange-behavior.md) |
| 55 | 55 |
- [Investigating the Guest Kernel](investigating-the-guest-kernel.md) |
| 56 | 56 |
- [Kernel Log Replication with VProbes](kernel-log-replication-with-vprobes.md) |
| 57 |
+ - [Troubleshooting Linux Kernel](Troubleshooting-linuxkernel.md) |
|
| 57 | 58 |
- [Performance Issues](performance-issues.md) |
| 58 | 59 |
- [General Guidelines](general_performance_guidelines.md) |
| 59 | 60 |
- [Throughput Performance](throughput_performance.md) |
| ... | ... |
@@ -7,4 +7,5 @@ Photon OS includes commands to troubleshoot kernel problems and boot and login e |
| 7 | 7 |
- [Blank Screen on Reboot](blank-screen-on-reboot.md) |
| 8 | 8 |
- [Investigating Unexpected Behavior](investigating-strange-behavior.md) |
| 9 | 9 |
- [Investigating the Guest Kernel](investigating-the-guest-kernel.md) |
| 10 |
-- [Kernel Log Replication with VProbes](kernel-log-replication-with-vprobes.md) |
|
| 11 | 10 |
\ No newline at end of file |
| 11 |
+- [Kernel Log Replication with VProbes](kernel-log-replication-with-vprobes.md) |
|
| 12 |
+- [Troubleshooting Linux Kernel](Troubleshooting-linuxkernel.md) |
|
| 12 | 13 |
\ No newline at end of file |
| ... | ... |
@@ -2,4 +2,149 @@ |
| 2 | 2 |
|
| 3 | 3 |
On Photon OS, all the system logs except the installation logs and the cloud-init logs are written into the systemd journal. The `journalctl` command queries the contents of the systemd journal. |
| 4 | 4 |
|
| 5 |
-The installation log files and the cloud-init log files reside in `/var/log`. If Photon OS is running on a virtual machine in a VMware hypervisor, the log file for the VMware tools, `vmware-vmsvc.log`, also resides in `/var/log`. |
|
| 6 | 5 |
\ No newline at end of file |
| 6 |
+The installation log files and the cloud-init log files reside in `/var/log`. If Photon OS is running on a virtual machine in a VMware hypervisor, the log file for the VMware tools, `vmware-vmsvc.log`, also resides in `/var/log`. |
|
| 7 |
+ |
|
| 8 |
+##Journalctl |
|
| 9 |
+Journalctl is a utility to query and display logs from journald and systemd’s logging service. Since journald stores log data in a binary format instead of a plain text format, `journalctl` is the standard way of reading log messages processed by journald. |
|
| 10 |
+ |
|
| 11 |
+Journald is a service provided by systemd. To see the staus of the daemon, run the following commands: |
|
| 12 |
+``` |
|
| 13 |
+# systemctl status systemd-journald |
|
| 14 |
+● systemd-journald.service - Journal Service |
|
| 15 |
+Loaded: loaded (/lib/systemd/system/systemd-journald.service; static; vendor preset: enabled) |
|
| 16 |
+Active: active (running) since Tue 2020-04-07 14:33:41 CST; 2 days ago |
|
| 17 |
+Docs: man:systemd-journald.service(8) |
|
| 18 |
+man:journald.conf(5) |
|
| 19 |
+Main PID: 943 (systemd-journal) |
|
| 20 |
+Status: "Processing requests..." |
|
| 21 |
+Tasks: 1 (limit: 4915) |
|
| 22 |
+Memory: 18.0M |
|
| 23 |
+CGroup: /system.slice/systemd-journald.service |
|
| 24 |
+└─943 /lib/systemd/systemd-journald |
|
| 25 |
+ |
|
| 26 |
+ |
|
| 27 |
+ |
|
| 28 |
+Apr 07 14:33:41 photon-4a0e7f2307d4 systemd-journald[943]: Journal started |
|
| 29 |
+Apr 07 14:33:41 photon-4a0e7f2307d4 systemd-journald[943]: Runtime journal (/run/log/journal/b8cebc61a6cb446a968ee1d4c5bbbbd5) is 8.0M, max 1.5G, 1.5G free. |
|
| 30 |
+Apr 07 14:33:41 photon-4a0e7f2307d4 systemd-journald[943]: Time spent on flushing to /var is 88.263ms for 1455 entries. |
|
| 31 |
+Apr 07 14:33:41 photon-4a0e7f2307d4 systemd-journald[943]: System journal (/var/log/journal/b8cebc61a6cb446a968ee1d4c5bbbbd5) is 40.0M, max 4.0G, 3.9G free. |
|
| 32 |
+root@photon-4a0e7f2307d4 [ ~ ]# |
|
| 33 |
+``` |
|
| 34 |
+ |
|
| 35 |
+The following command are related to `journalctl`: |
|
| 36 |
+ |
|
| 37 |
+- `journalctl` : This command displays all the logs after the system has booted up. `journalctl` splits the results into pages, similar to the `less` command in Linux. You can navigate using the arrow keys, the Page Up, Page Down keys or the Space bar. To quit navigation, press the **q** key. |
|
| 38 |
+- `journalctl -b` : This command displays the logs for the current boot. |
|
| 39 |
+ |
|
| 40 |
+The following commands pull logs based on a time range: |
|
| 41 |
+ |
|
| 42 |
+- `journalctl --since "1 hour ago"` : This command displays the journal logs from the past 1 hour. |
|
| 43 |
+- `journalctl --since "2 days ago"` : This command displays the logs generated in the past 2 days. |
|
| 44 |
+- `journalctl --since "2020-03-25 00:00:00" --until "2020-04-09 00:00:00"` : This command displays the logs generated between the mentioned time frame. |
|
| 45 |
+ |
|
| 46 |
+To traverse for logs in the reverse order, run the following command: |
|
| 47 |
+ |
|
| 48 |
+- `journalctl -r` : This command displays the logs in reverse order. |
|
| 49 |
+ |
|
| 50 |
+**Note**: If you add `-r` at the end of a command, the logs are displayed in the reverse order. For example: `journalctl -u unit.service -r` |
|
| 51 |
+ |
|
| 52 |
+To pull logs related to a particular daemon, run the following command: |
|
| 53 |
+ |
|
| 54 |
+- `journalctl -u unit.service` : This command displays logs for a specific service. mention the name of the service instead of `unit`. This command helps when a service is not behaving properly or when there are crash/core dumps. |
|
| 55 |
+ |
|
| 56 |
+To see Journal logs by their priority, run the following command: |
|
| 57 |
+ |
|
| 58 |
+- `journalctl -p "emerg".."crit` : This command displays logs **emerg** to **critical**. For example: core dumps. |
|
| 59 |
+ |
|
| 60 |
+Journalctl can print log messages to the console as they are added, like the Linux `tail` command. Add the `-f` switch to follow a specific service or daemon. |
|
| 61 |
+``` |
|
| 62 |
+journalctl -u unit.service -f |
|
| 63 |
+``` |
|
| 64 |
+ |
|
| 65 |
+To list the boots of the system, run the following command: |
|
| 66 |
+``` |
|
| 67 |
+journalctl --list-boots |
|
| 68 |
+``` |
|
| 69 |
+ |
|
| 70 |
+You can maintain the journalctl logs manually, by running the following `vacuum` commands: |
|
| 71 |
+ |
|
| 72 |
+- `journalctl --vacuum-time=2d` : This command retains the logs from the last 2 days. |
|
| 73 |
+- `journalctl --vacuum-size=500M` : This command helps retain logs with a maximum size of 500 MB. |
|
| 74 |
+ |
|
| 75 |
+You can configure Journald using the conf file located at **/etc/systemd/journald.conf**. Run the following command to configure the file: |
|
| 76 |
+``` |
|
| 77 |
+# cat /etc/systemd/journald.conf |
|
| 78 |
+# This file is part of systemd. |
|
| 79 |
+# |
|
| 80 |
+# systemd is free software; you can redistribute it and/or modify it |
|
| 81 |
+# under the terms of the GNU Lesser General Public License as published by |
|
| 82 |
+# the Free Software Foundation; either version 2.1 of the License, or |
|
| 83 |
+# (at your option) any later version. |
|
| 84 |
+# |
|
| 85 |
+# Entries in this file show the compile time defaults. |
|
| 86 |
+# You can change settings by editing this file. |
|
| 87 |
+# Defaults can be restored by simply deleting this file. |
|
| 88 |
+# |
|
| 89 |
+# See journald.conf(5) for details. |
|
| 90 |
+ |
|
| 91 |
+[Journal] |
|
| 92 |
+#Storage=auto |
|
| 93 |
+#Compress=yes |
|
| 94 |
+#Seal=yes |
|
| 95 |
+#SplitMode=uid |
|
| 96 |
+#SyncIntervalSec=5m |
|
| 97 |
+#RateLimitIntervalSec=30s |
|
| 98 |
+#RateLimitBurst=10000 |
|
| 99 |
+#SystemMaxUse= |
|
| 100 |
+#SystemKeepFree= |
|
| 101 |
+#SystemMaxFileSize= |
|
| 102 |
+#SystemMaxFiles=100 |
|
| 103 |
+#RuntimeMaxUse= |
|
| 104 |
+#RuntimeKeepFree= |
|
| 105 |
+#RuntimeMaxFileSize= |
|
| 106 |
+#RuntimeMaxFiles=100 |
|
| 107 |
+#MaxRetentionSec= |
|
| 108 |
+#MaxFileSec=1month |
|
| 109 |
+#ForwardToSyslog=no |
|
| 110 |
+#ForwardToKMsg=no |
|
| 111 |
+#ForwardToConsole=no |
|
| 112 |
+#ForwardToWall=yes |
|
| 113 |
+#TTYPath=/dev/console |
|
| 114 |
+#MaxLevelStore=debug |
|
| 115 |
+#MaxLevelSyslog=debug |
|
| 116 |
+#MaxLevelKMsg=notice |
|
| 117 |
+#MaxLevelConsole=info |
|
| 118 |
+#MaxLevelWall=emerg |
|
| 119 |
+#LineMax=48K |
|
| 120 |
+root@photon-4a0e7f2307d4 [ ~ ]# |
|
| 121 |
+``` |
|
| 122 |
+By default `rotate` is disable in Photon. Once the changes are made to the conf file, for the changes to take effect you must restart the systemd-journald by running the `systemctl restart systemd-journald` command. |
|
| 123 |
+ |
|
| 124 |
+##Cloud-init Logs |
|
| 125 |
+Cloud-init is the industry standard multi-distribution method for cross-platform cloud instance initialisation. |
|
| 126 |
+ |
|
| 127 |
+If there are with the Cloud-init behaviour, we can debug them by looking at the logs. Run the following command to look at Cloud-init logs: |
|
| 128 |
+``` |
|
| 129 |
+journalctl -u cloud-init |
|
| 130 |
+``` |
|
| 131 |
+ |
|
| 132 |
+For better understanding/debugging, You can also look at logs from the following locations: |
|
| 133 |
+ |
|
| 134 |
+- **/var/log/cloud-init.log** : This log contains information from each stage of Cloud-init. |
|
| 135 |
+- **/var/log/cloud-init-output.log** : This log contains errors, warnings, etc.. |
|
| 136 |
+ |
|
| 137 |
+ |
|
| 138 |
+##Syslog |
|
| 139 |
+Syslog is the general standard for logging system and program messages in the Linux environment. |
|
| 140 |
+ |
|
| 141 |
+Photon provides the following two packages to support syslog: |
|
| 142 |
+ |
|
| 143 |
+- **syslog-ng** : syslog-ng is syslog with some advanced next gen features. It supports TLS encryption, TCP for transport with other existing features. Configurations can be added to the **/etc/syslog-ng/syslog-ng.conf** file. |
|
| 144 |
+- **rsyslog** : The official RSYSLOG website defines the utility as "the rocket-fast system for log processing". rsyslog supports some advanced features like relp, imfile, omfile, gnutls protocols. Configurations can be added to the **/etc/rsyslog.conf** file. You can configure the required TLS certificates by editing the conf file. |
|
| 145 |
+ |
|
| 146 |
+##Logs for RPMS on Photon |
|
| 147 |
+Logs for a particular RPM can be checked in the following ways: |
|
| 148 |
+ |
|
| 149 |
+- If the RPM provides a daemon, we can see the status of daemon by running `systemctl` command and check logs using `journactl -u <service name>` command. |
|
| 150 |
+- For additional logs, check if a conf file is provided by the RPM by running the `rpm -ql <rpm name> | grep conf` command and find the file path of the log file. You can also check the **/var/log** folder. |
|
| 151 |
+ |