Last Updated: February 25, 2016
·
549
· lesterchan

Tail Today's Apache error_log

Sometimes your web server might be configured in a way that the latest log entries does not go into /etc/httpd/logs/error_log but instead it will be /etc/httpd/logs/error_log-20130815 (assuming 15th August 2013 is today's date).

I have to always see my Mac for today's date. So I decided to create an alias to make my life easier to tail today's error_log.

Create a tail_web alias in ~/.bashrc with the content below

alias tail_web="tail -f /etc/httpd/logs/error_log-$(date +"%Y%m%d")"

Now you can tail today's Apache error_log by running this command:

$ tail_web