The PHP access log is useful for evaluating how your application handles requests, this is especially true when evaluating the performance of PHP. You will need to SSH into your server as the app's system user to run these commands.
This variable must be set otherwise the remaining commands will not work. The variable will not persist across SSH sessions and must be set in any new sessions.
Replace SYSUSER with your apps system user and APPNAME with your application's name
LOGFILE=/srv/users/SYSUSER/log/APPNAME/APPNAME_phpX.Y.access.log
Verify the variable is set correctly.
echo "$LOGFILE"
The output should be similar to:
/srv/users/SYSUSER/log/APPNAME/APPNAME_phpX.Y.access.log
cat "$LOGFILE" | awk '{print $1}' | sort | uniq -c | sort -n | tail -n20
For example, set REMOTE_ADDR to an address you saw in the output of the above command.
REMOTE_ADDR=1.2.3.4 grep -F "$REMOTE_ADDR" "$LOGFILE"
wc -l "$LOGFILE"
This is useful to see the date and time when the current log file began.
head -n1 "$LOGFILE"
This is useful to see the date and time of the most recent request.
tail -n1 "$LOGFILE"
grep -cF " 404 " "$LOGFILE"
grep -F " 404 " "$LOGFILE" | tail -n1000
grep -cF -e " 301 " -e " 302 " "$LOGFILE"
grep -cF -e " 301 " -e " 302 " "$LOGFILE"