How to clear Ubuntu Apache2 error log?

The apache error log is where information regarding any errors or anomalies are recorded. To clear the Apache2 error log file, run below command on terminal

Ubuntu clear Apache2 error log

Apache writes records of its events in two types of logs: access logs and error logs.

sudo bash -c 'echo > /var/log/apache2/error.log'

How to View Apache Access & Error Log Files?

Location Of The Error Log
you can access Apache error logs from var/log/apache2/error.log.

CentOS/Fedora: /var/log/httpd/error_log

# grep ErrorLog /etc/httpd/conf/httpd.conf

Ubuntu/Debian: /var/log/apache2/error.log

# grep ErrorLog /etc/apache2/apache2.conf

How to View Apache Error Logs?

sudo tail -100 /var/log/apache2/error.log

Using Unix Command-Line Tools

  • /etc/httpd/log/access_log (on MacOS)
  • /var/log/apache/access. log.
  • /var/log/apache2/access. log.
  • /var/log/apache2/error. log.

Display the Last 100 Entries of the Access Log

sudo tail -100 /var/log/apache2/access.log

Display a Specific Term from Access Logs

sudo grep GET /var/log/apache2/access.log

I hope you get an idea about ubuntu apache log.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment