Use the apache 2.4 ErrorLogFormat directive
Use the new ErrorLogFormat directive to make the Keystone logs under Apache to look like the standard oslo log format. Change-Id: Ie823abf2fa06b8ce22027c21bef455808a4a768e
This commit is contained in:
parent
a90898d904
commit
d074dc7f7e
@ -6,6 +6,7 @@ Listen %ADMINPORT%
|
|||||||
WSGIProcessGroup keystone-public
|
WSGIProcessGroup keystone-public
|
||||||
WSGIScriptAlias / %PUBLICWSGI%
|
WSGIScriptAlias / %PUBLICWSGI%
|
||||||
WSGIApplicationGroup %{GLOBAL}
|
WSGIApplicationGroup %{GLOBAL}
|
||||||
|
%ERRORLOGFORMAT%
|
||||||
ErrorLog /var/log/%APACHE_NAME%/keystone.log
|
ErrorLog /var/log/%APACHE_NAME%/keystone.log
|
||||||
CustomLog /var/log/%APACHE_NAME%/access.log combined
|
CustomLog /var/log/%APACHE_NAME%/access.log combined
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
@ -15,6 +16,7 @@ Listen %ADMINPORT%
|
|||||||
WSGIProcessGroup keystone-admin
|
WSGIProcessGroup keystone-admin
|
||||||
WSGIScriptAlias / %ADMINWSGI%
|
WSGIScriptAlias / %ADMINWSGI%
|
||||||
WSGIApplicationGroup %{GLOBAL}
|
WSGIApplicationGroup %{GLOBAL}
|
||||||
|
%ERRORLOGFORMAT%
|
||||||
ErrorLog /var/log/%APACHE_NAME%/keystone.log
|
ErrorLog /var/log/%APACHE_NAME%/keystone.log
|
||||||
CustomLog /var/log/%APACHE_NAME%/access.log combined
|
CustomLog /var/log/%APACHE_NAME%/access.log combined
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
26
lib/apache
26
lib/apache
@ -61,6 +61,28 @@ function install_apache_wsgi {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# get_apache_version() - return the version of Apache installed
|
||||||
|
# This function is used to determine the Apache version installed. There are
|
||||||
|
# various differences between Apache 2.2 and 2.4 that warrant special handling.
|
||||||
|
function get_apache_version {
|
||||||
|
if is_ubuntu; then
|
||||||
|
local version_str=$(sudo /usr/sbin/apache2ctl -v | awk '/Server version/ {print $3}' | cut -f2 -d/)
|
||||||
|
elif is_fedora; then
|
||||||
|
local version_str=$(rpm -qa --queryformat '%{VERSION}' httpd)
|
||||||
|
elif is_suse; then
|
||||||
|
local version_str=$(rpm -qa --queryformat '%{VERSION}' apache2)
|
||||||
|
else
|
||||||
|
exit_distro_not_supported "cannot determine apache version"
|
||||||
|
fi
|
||||||
|
if [[ "$version_str" =~ ^2\.2\. ]]; then
|
||||||
|
echo "2.2"
|
||||||
|
elif [[ "$version_str" =~ ^2\.4\. ]]; then
|
||||||
|
echo "2.4"
|
||||||
|
else
|
||||||
|
exit_distro_not_supported "apache version not supported"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# apache_site_config_for() - The filename of the site's configuration file.
|
# apache_site_config_for() - The filename of the site's configuration file.
|
||||||
# This function uses the global variables APACHE_NAME and APACHE_CONF_DIR.
|
# This function uses the global variables APACHE_NAME and APACHE_CONF_DIR.
|
||||||
#
|
#
|
||||||
@ -87,8 +109,8 @@ function install_apache_wsgi {
|
|||||||
function apache_site_config_for {
|
function apache_site_config_for {
|
||||||
local site=$@
|
local site=$@
|
||||||
if is_ubuntu; then
|
if is_ubuntu; then
|
||||||
local apache_version=$(sudo /usr/sbin/apache2ctl -v | awk '/Server version/ {print $3}' | cut -f2 -d/)
|
local apache_version=$(get_apache_version)
|
||||||
if [[ "$apache_version" =~ ^2\.2\. ]]; then
|
if [[ "$apache_version" == "2.2" ]]; then
|
||||||
# Ubuntu 12.04 - Apache 2.2
|
# Ubuntu 12.04 - Apache 2.2
|
||||||
echo $APACHE_CONF_DIR/${site}
|
echo $APACHE_CONF_DIR/${site}
|
||||||
else
|
else
|
||||||
|
@ -123,6 +123,13 @@ function _config_keystone_apache_wsgi {
|
|||||||
sudo mkdir -p $KEYSTONE_WSGI_DIR
|
sudo mkdir -p $KEYSTONE_WSGI_DIR
|
||||||
|
|
||||||
local keystone_apache_conf=$(apache_site_config_for keystone)
|
local keystone_apache_conf=$(apache_site_config_for keystone)
|
||||||
|
local apache_version=$(get_apache_version)
|
||||||
|
|
||||||
|
if [[ ${apache_version#*\.} -ge 4 ]]; then
|
||||||
|
# Apache 2.4 supports custom error log formats
|
||||||
|
# this should mirror the original log formatting.
|
||||||
|
local errorlogformat='ErrorLogFormat "%{cu}t %M"'
|
||||||
|
fi
|
||||||
|
|
||||||
# copy proxy vhost and wsgi file
|
# copy proxy vhost and wsgi file
|
||||||
sudo cp $KEYSTONE_DIR/httpd/keystone.py $KEYSTONE_WSGI_DIR/main
|
sudo cp $KEYSTONE_DIR/httpd/keystone.py $KEYSTONE_WSGI_DIR/main
|
||||||
@ -136,6 +143,7 @@ function _config_keystone_apache_wsgi {
|
|||||||
s|%PUBLICWSGI%|$KEYSTONE_WSGI_DIR/main|g;
|
s|%PUBLICWSGI%|$KEYSTONE_WSGI_DIR/main|g;
|
||||||
s|%ADMINWSGI%|$KEYSTONE_WSGI_DIR/admin|g;
|
s|%ADMINWSGI%|$KEYSTONE_WSGI_DIR/admin|g;
|
||||||
s|%USER%|$STACK_USER|g
|
s|%USER%|$STACK_USER|g
|
||||||
|
s|%ERRORLOGFORMAT%|$errorlogformat|g;
|
||||||
" -i $keystone_apache_conf
|
" -i $keystone_apache_conf
|
||||||
enable_apache_site keystone
|
enable_apache_site keystone
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user