You can change LogFormat for Apache with the following steps
- Create /usr/local/psa/admin/conf/templates/custom/ custom template folder:
Code:
# mkdir -p /usr/local/psa/admin/conf/templates/custom/
- Copy /usr/local/psa/admin/conf/templates/default/server.php into custom template folder:
Code:
# cp -a /usr/local/psa/admin/conf/templates/default/server.php /usr/local/psa/admin/conf/templates/custom/server.php
- Open /usr/local/psa/admin/conf/templates/custom/server.php file using any text editor.
- Change log format in custom template in the following section according to Apache documentation:
Code:
<IfModule mod_logio.c>
LogFormat "<?php echo $VAR->server->webserver->apache->pipelogEnabled ? '%v@@%p@@' : ''?>%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" plesklog
</IfModule>
<IfModule !mod_logio.c>
LogFormat "<?php echo $VAR->server->webserver->apache->pipelogEnabled ? '%v@@%p@@' : ''?>%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" plesklog
</IfModule>
- Check that the modified template is a valid PHP file:
Code:
# php -l /usr/local/psa/admin/conf/templates/custom/server.php
No syntax errors detected in /usr/local/psa/admin/conf/templates/custom/server.php
- Regenerate server configuration based on the new template:
Code:
# plesk sbin httpdmng --reconfigure-server
Note: customizing Apache access log format may break webstatistics calculation as webstat tools (Webalizer and Awstats) use CLF (
Common Log Format) when each line in a file stored in the Common Log Format has the strictly defined syntax.
More information can be found in Plesk and Apache documentation:
Changing Virtual Hosts Settings Using Configuration Templates
Apache Log Files