To view the Linux system logs on a cloud server, you can use several standard commands and tools. Here's how:
Check logs in /var/log/:
Most Linux system logs are stored in the /var/log/ directory. Common logs include:
/var/log/syslog or /var/log/messages (general system logs)/var/log/auth.log (authentication logs, e.g., SSH login attempts)/var/log/kern.log (kernel-related logs)/var/log/dmesg (boot and hardware-related logs)Example:
cat /var/log/syslog
Or use less for easier navigation:
less /var/log/syslog
Use journalctl (for systems with systemd):
If your cloud server uses systemd, you can view logs with journalctl.
Example:
journalctl -xe # View recent logs with detailed explanations
To filter logs by a specific service (e.g., sshd):
journalctl -u sshd
Check boot logs with dmesg:
To view kernel and hardware-related logs:
dmesg | less
Monitor logs in real-time with tail:
Use tail -f to follow log updates in real-time.
Example:
tail -f /var/log/syslog
For cloud servers, Tencent Cloud provides enhanced log management services:
These tools simplify log analysis and troubleshooting for cloud-based Linux servers.