From 1ff4e58d70197263f5e0fd40f727ceb5ecf00e65 Mon Sep 17 00:00:00 2001 From: Doug Szumski Date: Wed, 27 Jan 2021 15:08:04 +0000 Subject: [PATCH] Fix Barbican API log config There are a few issues fixed here: - The Barbican API service doesn't set a log file, so all the Barbican API service logs go to loadwsgi.py.log by default. - The logs in loadwsgi.py.log are not ingested properly by Fluentd. - uWSGI logs go to barbican-api.log. This would normally be used as the log file for the Barbican API service logs. This patch makes the following changes to address the above issues: - All uWSGI logs (from the Emperor and Vassals) go to barbican_api_uwsgi_access.log Although these logs aren't strictly all access logs, this follows the existing pattern for WSGI logs. - The Barbican API service logs are written to barbican-api.log instead of loadwsgi.py.log. This follows the pattern used by other OpenStack services. - Fluentd is configured to parse the Barbican API service logs as it would with other OpenStack Python services. Change-Id: I6d03fa8c81c52b6f061514a836bbd15bb6639aaf Closes-Bug: #1891343 --- ansible/roles/barbican/templates/barbican-api.ini.j2 | 1 + ansible/roles/barbican/templates/barbican-api.json.j2 | 2 +- ansible/roles/barbican/templates/barbican.conf.j2 | 3 +++ .../common/templates/conf/filter/01-rewrite-0.12.conf.j2 | 4 ++-- .../common/templates/conf/filter/01-rewrite-0.14.conf.j2 | 4 ++-- .../notes/fix-barbican-logging-42068f47fe1e4e4d.yaml | 5 +++++ 6 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/fix-barbican-logging-42068f47fe1e4e4d.yaml diff --git a/ansible/roles/barbican/templates/barbican-api.ini.j2 b/ansible/roles/barbican/templates/barbican-api.ini.j2 index e8dad55f12..d0dfbbd37e 100644 --- a/ansible/roles/barbican/templates/barbican-api.ini.j2 +++ b/ansible/roles/barbican/templates/barbican-api.ini.j2 @@ -12,3 +12,4 @@ memory-report = true plugins = python3 paste = config:/etc/barbican/barbican-api-paste.ini add-header = Connection: close +logto = /var/log/kolla/barbican/barbican_api_uwsgi_access.log diff --git a/ansible/roles/barbican/templates/barbican-api.json.j2 b/ansible/roles/barbican/templates/barbican-api.json.j2 index e28191aae1..a807c17ea4 100644 --- a/ansible/roles/barbican/templates/barbican-api.json.j2 +++ b/ansible/roles/barbican/templates/barbican-api.json.j2 @@ -1,5 +1,5 @@ { - "command": "uwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.log --logfile-chmod 644", + "command": "uwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican_api_uwsgi_access.log --logfile-chmod 644", "config_files": [ { "source": "{{ container_config_directory }}/barbican.conf", diff --git a/ansible/roles/barbican/templates/barbican.conf.j2 b/ansible/roles/barbican/templates/barbican.conf.j2 index 1c858fa6dd..62412b21ef 100644 --- a/ansible/roles/barbican/templates/barbican.conf.j2 +++ b/ansible/roles/barbican/templates/barbican.conf.j2 @@ -1,6 +1,9 @@ [DEFAULT] debug = {{ barbican_logging_debug }} log_dir = /var/log/kolla/barbican +{% if service_name == "barbican-api" %} +log_file = barbican-api.log +{% endif %} bind_port = {{ barbican_api_listen_port }} bind_host = {{ api_interface_address }} diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 index 26d8395776..1c607c8ad6 100644 --- a/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 +++ b/ansible/roles/common/templates/conf/filter/01-rewrite-0.12.conf.j2 @@ -2,7 +2,7 @@ @type rewrite_tag_filter capitalize_regex_backreference yes rewriterule1 programname ^(cinder-api-access|cloudkitty-api-access|gnocchi-api-access|horizon-access|keystone-apache-admin-access|keystone-apache-public-access|monasca-api-access|placement-api-access|panko-api-access)$ apache_access - rewriterule2 programname ^(aodh_wsgi_access|barbican-api|zun_api_wsgi_access|vitrage_wsgi_access)$ wsgi_access + rewriterule2 programname ^(aodh_wsgi_access|barbican_api_uwsgi_access|zun_api_wsgi_access|vitrage_wsgi_access)$ wsgi_access rewriterule3 programname ^(nova-api|nova-compute|nova-compute-ironic|nova-conductor|nova-manage|nova-novncproxy|nova-scheduler|nova-placement-api|placement-api|privsep-helper)$ openstack_python rewriterule4 programname ^(sahara-api|sahara-engine)$ openstack_python rewriterule5 programname ^(neutron-server|neutron-openvswitch-agent|neutron-ns-metadata-proxy|neutron-metadata-agent|neutron-l3-agent|neutron-dhcp-agent)$ openstack_python @@ -12,7 +12,7 @@ rewriterule9 programname ^(glance-api)$ openstack_python rewriterule10 programname ^(cloudkitty-storage-init|cloudkitty-processor|cloudkitty-dbsync|cloudkitty-api)$ openstack_python rewriterule11 programname ^(ceilometer-polling|ceilometer-agent-notification)$ openstack_python - rewriterule12 programname ^(barbican-worker|barbican-keystone-listener|barbican-db-manage|app)$ openstack_python + rewriterule12 programname ^(barbican-api|barbican-worker|barbican-keystone-listener|barbican-db-manage|app)$ openstack_python rewriterule13 programname ^(aodh-notifier|aodh-listener|aodh-evaluator|aodh-dbsync)$ openstack_python rewriterule14 programname ^(cinder-api|cinder-scheduler|cinder-manage|cinder-volume|cinder-backup|privsep-helper)$ openstack_python rewriterule15 programname ^(mistral-server|mistral-engine|mistral-executor)$ openstack_python diff --git a/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 b/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 index c6d58f39d3..8ba4468ce4 100644 --- a/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 +++ b/ansible/roles/common/templates/conf/filter/01-rewrite-0.14.conf.j2 @@ -8,7 +8,7 @@ key programname - pattern ^(aodh_wsgi_access|barbican-api|zun_api_wsgi_access|vitrage_wsgi_access)$ + pattern ^(aodh_wsgi_access|barbican_api_uwsgi_access|zun_api_wsgi_access|vitrage_wsgi_access)$ tag wsgi_access @@ -58,7 +58,7 @@ key programname - pattern ^(barbican-worker|barbican-keystone-listener|barbican-db-manage|app)$ + pattern ^(barbican-api|barbican-worker|barbican-keystone-listener|barbican-db-manage|app)$ tag openstack_python diff --git a/releasenotes/notes/fix-barbican-logging-42068f47fe1e4e4d.yaml b/releasenotes/notes/fix-barbican-logging-42068f47fe1e4e4d.yaml new file mode 100644 index 0000000000..96d13b6de4 --- /dev/null +++ b/releasenotes/notes/fix-barbican-logging-42068f47fe1e4e4d.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes some configuration issues around Barbican logging. `LP#1891343 + `__