From 3f55b870694b4dcf3c58ce1bf2289c34798ede84 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Wed, 4 Dec 2019 11:39:59 +0100 Subject: [PATCH] Improve Apache logging Currently we don't put global Apache error logs into /var/log/kolla, this change adds statements that redirect those logs there. Adapted the logfile names to catch into openstack wsgi logging fluentd input config and existing logrotate cron entries. Change-Id: I21216e688a1993239e3e81411a4e8b6f13e138c2 --- ansible/roles/aodh/templates/wsgi-aodh.conf.j2 | 10 ++++++++-- .../roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2 | 10 ++++++++-- .../roles/freezer/templates/wsgi-freezer-api.conf.j2 | 5 +++++ ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 | 10 ++++++++-- ansible/roles/keystone/templates/wsgi-keystone.conf.j2 | 5 +++++ ansible/roles/masakari/templates/wsgi-masakari.conf.j2 | 10 ++++++++-- .../monasca/templates/monasca-api/wsgi-api.conf.j2 | 10 ++++++++-- .../templates/monasca-log-api/wsgi-log-api.conf.j2 | 10 ++++++++-- ansible/roles/panko/templates/wsgi-panko.conf.j2 | 10 ++++++++-- ansible/roles/qinling/templates/wsgi-qinling.conf.j2 | 10 ++++++++-- ansible/roles/vitrage/templates/wsgi-vitrage.conf.j2 | 10 ++++++++-- ansible/roles/zun/templates/wsgi-zun.conf.j2 | 10 ++++++++-- 12 files changed, 90 insertions(+), 20 deletions(-) diff --git a/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 b/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 index 4a86b7af42..c9af178cf7 100644 --- a/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 +++ b/ansible/roles/aodh/templates/wsgi-aodh.conf.j2 @@ -1,3 +1,4 @@ +{% set aodh_log_dir = '/var/log/kolla/aodh' %} {% if aodh_install_type == 'binary' %} {% set python_path = '/usr/lib/python3/dist-packages' if kolla_base_distro in ['debian', 'ubuntu'] else '/usr/lib/python2.7/site-packages' %} {% else %} @@ -10,6 +11,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ aodh_log_dir }}/apache-error.log" + + CustomLog "{{ aodh_log_dir }}/apache-access.log" common + + {% if aodh_logging_debug | bool %} LogLevel info {% endif %} @@ -24,10 +30,10 @@ LogLevel info ## Logging - ErrorLog "/var/log/kolla/aodh/aodh_wsgi_error.log" + ErrorLog "{{ aodh_log_dir }}/aodh_wsgi_error.log" ServerSignature Off LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/aodh/aodh_wsgi_access.log" logformat + CustomLog "{{ aodh_log_dir }}/aodh_wsgi_access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess aodh group=aodh processes={{ openstack_service_workers }} threads=1 user=aodh python-path={{ python_path }} WSGIProcessGroup aodh diff --git a/ansible/roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2 b/ansible/roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2 index 1939705146..8c52f6c9cd 100644 --- a/ansible/roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2 +++ b/ansible/roles/cloudkitty/templates/wsgi-cloudkitty.conf.j2 @@ -1,3 +1,4 @@ +{% set cloudkitty_log_dir = '/var/log/kolla/cloudkitty' %} {% set python_path = '/usr/lib/python2.7/site-packages' if cloudkitty_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} {% set binary_path = '/usr/bin' if cloudkitty_install_type == 'binary' else '/var/lib/kolla/venv/bin' %} Listen {{ api_interface_address | put_address_in_context('url') }}:{{ cloudkitty_api_port }} @@ -6,15 +7,20 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ cloudkitty_log_dir }}/apache-error.log" + + CustomLog "{{ cloudkitty_log_dir }}/apache-access.log" common + + {% if cloudkitty_logging_debug | bool %} LogLevel info {% endif %} - ErrorLog "/var/log/kolla/cloudkitty/cloudkitty-api-error.log" + ErrorLog "{{ cloudkitty_log_dir }}/cloudkitty-api-error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/cloudkitty/cloudkitty-api-access.log" logformat + CustomLog "{{ cloudkitty_log_dir }}/cloudkitty-api-access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess cloudkitty group=cloudkitty processes={{ openstack_service_workers }} threads=1 user=cloudkitty python-path={{ python_path }} WSGIProcessGroup cloudkitty diff --git a/ansible/roles/freezer/templates/wsgi-freezer-api.conf.j2 b/ansible/roles/freezer/templates/wsgi-freezer-api.conf.j2 index 69e9e32446..746ef853e7 100644 --- a/ansible/roles/freezer/templates/wsgi-freezer-api.conf.j2 +++ b/ansible/roles/freezer/templates/wsgi-freezer-api.conf.j2 @@ -6,6 +6,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ freezer_log_dir }}/apache-error.log" + + CustomLog "{{ freezer_log_dir }}/apache-access.log" common + + {% if freezer_logging_debug | bool %} LogLevel info {% endif %} diff --git a/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 b/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 index c7d3dfa405..b545bf6bca 100644 --- a/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 +++ b/ansible/roles/gnocchi/templates/wsgi-gnocchi.conf.j2 @@ -1,3 +1,4 @@ +{% set gnocchi_log_dir = '/var/log/kolla/gnocchi' %} {% if gnocchi_install_type == 'binary' %} {% set python_path = '/usr/lib/python3/dist-packages' if kolla_base_distro in ['debian', 'ubuntu'] else '/usr/lib/python2.7/site-packages' %} {% else %} @@ -10,15 +11,20 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ gnocchi_log_dir }}/apache-error.log" + + CustomLog "{{ gnocchi_log_dir }}/apache-access.log" common + + {% if gnocchi_logging_debug | bool %} LogLevel info {% endif %} - ErrorLog "/var/log/kolla/gnocchi/gnocchi-api-error.log" + ErrorLog "{{ gnocchi_log_dir }}/gnocchi-api-error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/gnocchi/gnocchi-api-access.log" logformat + CustomLog "{{ gnocchi_log_dir }}/gnocchi-api-access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess gnocchi group=gnocchi processes={{ openstack_service_workers }} threads=1 user=gnocchi python-path={{ python_path }} WSGIProcessGroup gnocchi diff --git a/ansible/roles/keystone/templates/wsgi-keystone.conf.j2 b/ansible/roles/keystone/templates/wsgi-keystone.conf.j2 index 107d4ea546..c630834441 100644 --- a/ansible/roles/keystone/templates/wsgi-keystone.conf.j2 +++ b/ansible/roles/keystone/templates/wsgi-keystone.conf.j2 @@ -12,6 +12,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ keystone_log_dir }}/apache-error.log" + + CustomLog "{{ keystone_log_dir }}/apache-access.log" common + + {% if keystone_logging_debug | bool %} LogLevel info {% endif %} diff --git a/ansible/roles/masakari/templates/wsgi-masakari.conf.j2 b/ansible/roles/masakari/templates/wsgi-masakari.conf.j2 index 86b8483282..780b656972 100644 --- a/ansible/roles/masakari/templates/wsgi-masakari.conf.j2 +++ b/ansible/roles/masakari/templates/wsgi-masakari.conf.j2 @@ -1,3 +1,4 @@ +{% set masakari_log_dir = '/var/log/kolla/masakari' %} {% if kolla_base_distro in ['debian', 'ubuntu'] %} {% set python_path = '/usr/lib/python3/dist-packages' if masakari_install_type == 'binary' else '/var/lib/kolla/venv/lib/python' + distro_python_version + '/site-packages' %} {% else %} @@ -11,6 +12,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ masakari_log_dir }}/apache-error.log" + + CustomLog "{{ masakari_log_dir }}/apache-access.log" common + + {% if masakari_logging_debug | bool %} LogLevel info {% endif %} @@ -24,9 +30,9 @@ LogLevel info ## Logging - ErrorLog "/var/log/kolla/masakari/masakari_wsgi_error.log" + ErrorLog "{{ masakari_log_dir }}/masakari_wsgi_error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/masakari/masakari_wsgi_access.log" logformat + CustomLog "{{ masakari_log_dir }}/masakari_wsgi_access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess masakari group=masakari processes={{ openstack_service_workers }} threads=1 user=masakari python-path={{ python_path }} WSGIProcessGroup masakari diff --git a/ansible/roles/monasca/templates/monasca-api/wsgi-api.conf.j2 b/ansible/roles/monasca/templates/monasca-api/wsgi-api.conf.j2 index 35e38bff7b..12c71444d9 100644 --- a/ansible/roles/monasca/templates/monasca-api/wsgi-api.conf.j2 +++ b/ansible/roles/monasca/templates/monasca-api/wsgi-api.conf.j2 @@ -1,3 +1,4 @@ +{% set monasca_log_path = '/var/log/kolla/monasca' %} {% set python_path = '/usr/lib/python2.7/site-packages' if monasca_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} {% set wsgi_path = '/usr/bin' if monasca_install_type == 'binary' else '/monasca-api/monasca_api/api' %} @@ -5,15 +6,20 @@ Listen {{ api_interface_address | put_address_in_context('url') }}:{{ monasca_ap TraceEnable off +ErrorLog "{{ monasca_log_dir }}/apache-api-error.log" + + CustomLog "{{ monasca_log_dir }}/apache-api-access.log" common + + {% if monasca_logging_debug | bool %} LogLevel info {% endif %} - ErrorLog "/var/log/kolla/monasca/monasca-api-error.log" + ErrorLog "{{ monasca_log_dir }}/monasca-api-error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/monasca/monasca-api-access.log" logformat + CustomLog "{{ monasca_log_dir }}/monasca-api-access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess monasca-api group=monasca processes={{ openstack_service_workers }} threads=1 user=monasca python-path={{ python_path }} WSGIProcessGroup monasca-api diff --git a/ansible/roles/monasca/templates/monasca-log-api/wsgi-log-api.conf.j2 b/ansible/roles/monasca/templates/monasca-log-api/wsgi-log-api.conf.j2 index f21ff2987c..d3182743bf 100644 --- a/ansible/roles/monasca/templates/monasca-log-api/wsgi-log-api.conf.j2 +++ b/ansible/roles/monasca/templates/monasca-log-api/wsgi-log-api.conf.j2 @@ -1,3 +1,4 @@ +{% set monasca_log_path = '/var/log/kolla/monasca' %} {% set python_path = '/usr/lib/python2.7/site-packages' if monasca_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} {% set wsgi_path = '/usr/bin' if monasca_install_type == 'binary' else '/monasca-log/monasca_log_api/app' %} @@ -5,15 +6,20 @@ Listen {{ api_interface_address | put_address_in_context('url') }}:{{ monasca_lo TraceEnable off +ErrorLog "{{ monasca_log_dir }}/apache-logapi-error.log" + + CustomLog "{{ monasca_log_dir }}/apache-logapi-access.log" common + + {% if monasca_logging_debug | bool %} LogLevel info {% endif %} - ErrorLog "/var/log/kolla/monasca/monasca-log-api-error.log" + ErrorLog "{{ monasca_log_dir }}/monasca-log-api-error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/monasca/monasca-log-api-access.log" logformat + CustomLog "{{ monasca_log_dir }}/monasca-log-api-access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess monasca-log-api group=monasca processes={{ openstack_service_workers }} threads=1 user=monasca python-path={{ python_path }} WSGIProcessGroup monasca-log-api diff --git a/ansible/roles/panko/templates/wsgi-panko.conf.j2 b/ansible/roles/panko/templates/wsgi-panko.conf.j2 index 657aa38a0c..6b4a8a0353 100644 --- a/ansible/roles/panko/templates/wsgi-panko.conf.j2 +++ b/ansible/roles/panko/templates/wsgi-panko.conf.j2 @@ -1,3 +1,4 @@ +{% set panko_log_dir = '/var/log/kolla/panko' %} {% set python_path = '/usr/lib/python2.7/site-packages' if panko_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} {% set binary_path = '/usr/bin' if panko_install_type == 'binary' else '/var/lib/kolla/venv/bin' %} Listen {{ api_interface_address | put_address_in_context('url') }}:{{ panko_api_port }} @@ -6,6 +7,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ panko_log_dir }}/apache-error.log" + + CustomLog "{{ panko_log_dir }}/apache-access.log" common + + {% if panko_logging_debug | bool %} LogLevel info {% endif %} @@ -18,9 +24,9 @@ LogLevel info - ErrorLog "/var/log/kolla/panko/panko-api-error.log" + ErrorLog "{{ panko_log_dir }}/panko-api-error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/panko/panko-api-access.log" logformat + CustomLog "{{ panko_log_dir }}/panko-api-access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess panko group=panko processes={{ openstack_service_workers }} threads=1 user=panko python-path={{ python_path }} WSGIProcessGroup panko diff --git a/ansible/roles/qinling/templates/wsgi-qinling.conf.j2 b/ansible/roles/qinling/templates/wsgi-qinling.conf.j2 index f9b276137f..33613683aa 100644 --- a/ansible/roles/qinling/templates/wsgi-qinling.conf.j2 +++ b/ansible/roles/qinling/templates/wsgi-qinling.conf.j2 @@ -1,3 +1,4 @@ +{% set qinling_log_dir = '/var/log/kolla/qinling' %} {% if kolla_base_distro == 'ubuntu' %} {% set python_path = '/usr/lib/python3/dist-packages' if qinling_install_type == 'binary' else '/var/lib/kolla/venv/lib/python3.6/site-packages' %} {% else %} @@ -10,6 +11,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ qinling_log_dir }}/apache-error.log" + + CustomLog "{{ qinling_log_dir }}/apache-access.log" common + + {% if qinling_logging_debug | bool %} LogLevel info {% endif %} @@ -27,9 +33,9 @@ LogLevel info ## Logging - ErrorLog "/var/log/kolla/qinling/qinling_api_wsgi_error.log" + ErrorLog "{{ qinling_log_dir }}/qinling_api_wsgi_error.log" LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/qinling/qinling_api_wsgi_access.log" logformat + CustomLog "{{ qinling_log_dir }}/qinling_api_wsgi_access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess qinling group=qinling processes={{ openstack_service_workers }} threads=1 user=qinling python-path={{ python_path }} WSGIProcessGroup qinling diff --git a/ansible/roles/vitrage/templates/wsgi-vitrage.conf.j2 b/ansible/roles/vitrage/templates/wsgi-vitrage.conf.j2 index 054256ddfc..978bc69fe0 100644 --- a/ansible/roles/vitrage/templates/wsgi-vitrage.conf.j2 +++ b/ansible/roles/vitrage/templates/wsgi-vitrage.conf.j2 @@ -1,3 +1,4 @@ +{% set vitrage_log_dir = '/var/log/kolla/vitrage' %} {% set python_path = '/usr/lib/python2.7/site-packages' if vitrage_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} Listen {{ 'api' | kolla_address | put_address_in_context('url') }}:{{ vitrage_api_port }} @@ -5,6 +6,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ vitrage_log_dir }}/apache-error.log" + + CustomLog "{{ vitrage_log_dir }}/apache-access.log" common + + {% if vitrage_logging_debug | bool %} LogLevel info {% endif %} @@ -23,9 +29,9 @@ LogLevel info ## Logging - ErrorLog "/var/log/kolla/vitrage/vitrage_wsgi_error.log" + ErrorLog "{{ vitrage_log_dir }}/vitrage_wsgi_error.log" ServerSignature Off - CustomLog "/var/log/kolla/vitrage/vitrage_wsgi_access.log" combined + CustomLog "{{ vitrage_log_dir }}/vitrage_wsgi_access.log" combined WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess vitrage group=vitrage processes={{ openstack_service_workers }} threads=1 user=vitrage python-path={{ python_path }} WSGIProcessGroup vitrage diff --git a/ansible/roles/zun/templates/wsgi-zun.conf.j2 b/ansible/roles/zun/templates/wsgi-zun.conf.j2 index e906f7fa23..52a95852ee 100644 --- a/ansible/roles/zun/templates/wsgi-zun.conf.j2 +++ b/ansible/roles/zun/templates/wsgi-zun.conf.j2 @@ -1,3 +1,4 @@ +{% set zun_log_dir = '/var/log/kolla/zun' %} {% set python_path = '/usr/lib/python2.7/site-packages' if zun_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %} Listen {{ api_interface_address | put_address_in_context('url') }}:{{ zun_api_port }} @@ -5,6 +6,11 @@ ServerSignature Off ServerTokens Prod TraceEnable off +ErrorLog "{{ zun_log_dir }}/apache-error.log" + + CustomLog "{{ zun_log_dir }}/apache-access.log" common + + {% if zun_logging_debug | bool %} LogLevel info {% endif %} @@ -23,10 +29,10 @@ LogLevel info ## Logging - ErrorLog "/var/log/kolla/zun/zun_api_wsgi_error.log" + ErrorLog "{{ zun_log_dir }}/zun_api_wsgi_error.log" ServerSignature Off LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat - CustomLog "/var/log/kolla/zun/zun_api_wsgi_access.log" logformat + CustomLog "{{ zun_log_dir }}/zun_api_wsgi_access.log" logformat WSGIApplicationGroup %{GLOBAL} WSGIDaemonProcess zun group=zun processes={{ openstack_service_workers }} threads=1 user=zun python-path={{ python_path }} WSGIProcessGroup zun