Paths to some of the most important logs on your Dedicated server and how to use them
Browsing through the appropriate logs is key element of the troubleshooting process. If you are using a Dedicated hosting solution with root access at SiteGround you can access all of the server logs via SSH. For example, if your website loads slow, you will have to check few logs in order to find the exact reason for this and to apply a fix if possible.
Logs, however, can contain millions of lines. It is easy to get lost in so many information without filtering it.
Firstly, you can start by using the tail -n100 command to get the last 100 lines from the log file. You can change the number to broaden or narrow down your search.
Once you have the desired amount of results you need to search for a certain pattern in them. For example, you can type the following command to check the last 100 lines of the e-mail log file:
tail -n100 /var/log/exim_mainlog |grep "EMAIL"
Replacing EMAIL with your e-mail address will show you only the lines recorded about e-mails sent from or to the particular e-mail address.
Below, you can find the paths to some of the most useful logs:
- E-mail activity: Detailed information for each message you send or receive will be saved in this log - /var/log/exim_mainlog
- MySQL slow queries: If your databases produce "slow" queries, they will be written to this log - /var/lib/mysql/mysql-slow.log
- CronJobs executions log: Each time a cron job is executed, a log will be saved at this location - /var/log/cron
- FTP logs: The connections made to your server via FTP and the transferred files will be logged at these files - /var/log/messages
- Apache access log: This is the raw access log for your website. Each IP that has accessed your website will be logged here - /usr/local/apache/domlogs/YOURDOMAINNAME
- Apache Error Log - If the Apache web server fails to start, stop or restart, the error message will be saved to this file - /usr/local/apache/logs/error_log