Now and again you will want to check your server logs to see why you're getting a particular error message.
Firstly, before you can view any logs, you will need to be able to SSH in to your server. To do this, you will need to have a Code Enigma account and have provided us with your SSH public key. If you tick those boxes, you will be able to connect to the server in Mac OS X or Linux by running this command from the terminal:
Once you've connected to the server, you can view the system log by running this:
sudo tail /var/log/syslog
This will output the last 20 lines of the syslog. If you require more log entries, you can use the -nswitch, like so:
sudo tail -n 100 /var/log/syslog
The command above will display the last 100 lines of the syslog. Additionally, you can also follow the syslog by using the -f switch. This will append lines to the end of the syslog as it grows:
sudo tail -n 100 -f /var/log/syslog
The command above will display the last 100 lines of the syslog and automatically display new lines as they are appended to the file.
Of course, the above commands show everything. If you want to only view PHP errors, the grep command like so:
sudo grep PHP /var/log/syslog
Change 'PHP' to whatever it is you want to search for in the log.
If you want to view something in several files, for example if you want to see all traffic accessing the Drupal status report page, you can recursively grep as well. This command will search through all the files in the Nginx log directory for any mention of "admin/reports/status" and list those mentions:
sudo grep -r "admin/reports/status" /var/log/nginx/
You can also use grep with the tail command, whilst following the log:
sudo tail -n 100 -f syslog | grep PHP
This command will output appended data as the syslog grows, but only the data you've searched for (PHP in this example).
Sometimes you'll want a few lines either side of your grep results, some context. To achieve this you can use the -C option ('C' for context, indeed - note it is uppercase) to see a bit more of what's going on. This command, for example, will give you two lines either side of the search hit:
sudo grep -C 2 PHP /var/log/syslog
Of course, you can view other logs too. Simply move into the /var/log directory to view the available logs.
cd /var/log ls
You will need to use sudo to view most, if not all, of the logs.
If you need any more help with viewing logs or understanding some of the entries, create a ticket in Redmine and one of the support staff will get back to you. And don't forget, on all *nix-like systems you can type 'man' followed by the command you want more information about to read the manual (and press 'q' to exit).