How do I modify Apache LogFormat in PLESK?

I want to change the log format to include the website host, but I don't know how to change it in PLESK.

Upvotes: 1

Views: 2951

Answers (1)

Webservers that have Plesk installed use a format for logging defined in the Plesk configuration file /etc/httpd/conf.d/zz010_psa_httpd.conf

After looking on some posts on the PLESK forums, the solution that worked was to redefine the plesklog format, just after including the plesk configuration.

To do that I had to edit /etc/httpd/conf/httpd.conf and go to the part that says:

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf

And add after that the new log format for plesklog:

# Redefine plesk log format
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %{Host}i" plesklog

After that I have restarted apache with:

service httpd restart

And now I can check that my website logs are being saved in the new defined format:

tail -f /var/www/vhosts/<your-domain-here>/statistics/logs/access_log

Hope it helps someone!

Upvotes: 2

Related Questions