Activating Apache logs on QNAP hardware (EDIT: fix for QTS 4.1 onwards)

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

This is a quick guide for those needing to debug web apps, such as ownCloud, on QNAP hardware.

QNAP systems only come with an Apache error log by default, which only logs apache service errors, not page errors, which make impossible to debug problems on sites. The only way to get more detailed logs is to add a few new config files to Apache, as follows:

  1. Login to the QNAP device through SSH
  2. Enable .htaccess usage on Apache. To do this you need to create a new Apache configuration file:
    vi /etc/config/apache/extra/apache-myconfig.conf

    And add the following commands:

    CustomLog logs/main_log combined
    ErrorLog logs/error_log
    LogLevel info
  3. Reference this new configuration file on Apache main configuration file. To do this, edit Apache configuration file:
    vi /etc/config/apache/apache.conf

    and add the following line at the end of the file:

    Include /etc/config/apache/extra/apache-myconfig.conf

Finally, restart Apache.

 /etc/init.d/Qthttpd.sh restart

Now, this own’t work on QNAP running QTS 4.1.x onwards, as people from QNAP thought it was working far too good, and decided to through a challenge. For some reason, Apache configuration files are reset every time Apache is restarted by Qnap startup scripts. So until I get a stable solution, the workaround is to manually restart Apache:

/usr/local/apache/bin/apachectl restart

The files will be present on /mnt/ext/opt/apache/logs/ .



Please note, all files will be restarted at 0:00, in order not to fill the partion .

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply