Add systemd journal logging to the service config

The systemd journal would normally be populated with the standard out of
a service however with the use of uwsgi this is not actually happening
resulting in us only capturing the logs from the uwsgi process instead
of the service itself. This change implements journal logging in the
service config, which is part of OSLO logging.

OSLO logging docs found here: <https://docs.openstack.org/oslo.log/3.28.1/journal.html>

Change-Id: I943bd5f1ac767f83d853cee09a5857f6f9f0efff
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter
2018-07-24 14:36:09 -05:00
committed by Kevin Carter (cloudnull)
parent a8081d658d
commit ac9d598d33
10 changed files with 42 additions and 30 deletions

View File

@@ -432,6 +432,7 @@ keystone_pip_packages:
- PyMySQL - PyMySQL
- python-memcached - python-memcached
- python-openstackclient - python-openstackclient
- systemd-python
- uWSGI - uWSGI
# This variable is used by the repo_build process to determine # This variable is used by the repo_build process to determine

View File

@@ -0,0 +1,9 @@
---
deprecations:
- The log path, ``/var/log/keystone`` is no longer used to capture service
logs. All logging for the Keystone service will now be sent directly to the
systmed journal.
other:
- When running keystone with apache(httpd) all apache logs will be stored in
the standard apache log directory which is controlled by the distro specific
variable ``keystone_apache_default_log_folder``.

View File

@@ -84,24 +84,3 @@
- { path: "/etc/ansible/facts.d", owner: root, group: root } - { path: "/etc/ansible/facts.d", owner: root, group: root }
delegate_to: "{{ item[0] }}" delegate_to: "{{ item[0] }}"
when: "inventory_hostname == ansible_play_hosts[0]" when: "inventory_hostname == ansible_play_hosts[0]"
- name: Test for log directory or link
shell: |
if [ -h "/var/log/keystone" ]; then
chown -h {{ keystone_system_user_name }}:{{ keystone_system_group_name }} "/var/log/keystone"
chown -R {{ keystone_system_user_name }}:{{ keystone_system_group_name }} "$(readlink /var/log/keystone)"
else
exit 1
fi
register: log_dir
failed_when: false
changed_when: log_dir.rc != 0
- name: Create keystone log dir
file:
path: "/var/log/keystone"
state: directory
owner: "{{ keystone_system_user_name }}"
group: "{{ keystone_system_group_name }}"
mode: "0755"
when: log_dir.rc != 0

View File

@@ -8,8 +8,9 @@ Listen {{ keystone_service_port }}
</IfVersion> </IfVersion>
LogLevel {{ keystone_apache_log_level }} LogLevel {{ keystone_apache_log_level }}
ErrorLog /var/log/keystone/keystone-apache-error.log # NOTE(Cloudnull): Log files can changed to use "mod_journal" when Apache 2.5 is released
CustomLog /var/log/keystone/ssl_access.log {{ keystone_apache_custom_log_format }} ErrorLog {{ keystone_apache_default_log_folder }}/keystone-apache-error.log
CustomLog {{ keystone_apache_default_log_folder }}/ssl_access.log {{ keystone_apache_custom_log_format }}
Options +FollowSymLinks Options +FollowSymLinks
Header set X-Content-Type-Options "nosniff" Header set X-Content-Type-Options "nosniff"
@@ -76,8 +77,9 @@ Listen {{ keystone_admin_port }}
</IfVersion> </IfVersion>
LogLevel {{ keystone_apache_log_level }} LogLevel {{ keystone_apache_log_level }}
ErrorLog /var/log/keystone/keystone-apache-error.log # NOTE(Cloudnull): Log files can changed to use "mod_journal" when Apache 2.5 is released
CustomLog /var/log/keystone/ssl_access.log {{ keystone_apache_custom_log_format }} ErrorLog {{ keystone_apache_default_log_folder }}/keystone-apache-error.log
CustomLog {{ keystone_apache_default_log_folder }}/ssl_access.log {{ keystone_apache_custom_log_format }}
Options +FollowSymLinks Options +FollowSymLinks

View File

@@ -1,6 +1,7 @@
# {{ ansible_managed }} # {{ ansible_managed }}
[DEFAULT] [DEFAULT]
use_journal = True
# Disable stderr logging # Disable stderr logging
use_stderr = False use_stderr = False
debug = {{ debug }} debug = {{ debug }}
@@ -15,9 +16,6 @@ member_role_name = {{ keystone_default_role_name }}
secure_proxy_ssl_header = {{ keystone_secure_proxy_ssl_header }} secure_proxy_ssl_header = {{ keystone_secure_proxy_ssl_header }}
{% endif %} {% endif %}
log_file = keystone.log
log_dir = /var/log/keystone
## Oslo.Messaging RPC ## Oslo.Messaging RPC
{% if keystone_messaging_enabled | bool %} {% if keystone_messaging_enabled | bool %}
transport_url = {{ keystone_oslomsg_rpc_transport }}://{% for host in keystone_oslomsg_rpc_servers.split(',') %}{{ keystone_oslomsg_rpc_userid }}:{{ keystone_oslomsg_rpc_password }}@{{ host }}:{{ keystone_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ keystone_oslomsg_rpc_vhost }}{% if keystone_oslomsg_rpc_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} transport_url = {{ keystone_oslomsg_rpc_transport }}://{% for host in keystone_oslomsg_rpc_servers.split(',') %}{{ keystone_oslomsg_rpc_userid }}:{{ keystone_oslomsg_rpc_password }}@{{ host }}:{{ keystone_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ keystone_oslomsg_rpc_vhost }}{% if keystone_oslomsg_rpc_use_ssl | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}

View File

@@ -19,8 +19,8 @@ server {
{{ line }} {{ line }}
{%- endfor %} {%- endfor %}
access_log /var/log/nginx/{{ item }}-access.log custom; error_log syslog:server=unix:/dev/log;
error_log /var/log/nginx/{{ item }}-error.log info; access_log syslog:server=unix:/dev/log;
add_header X-Content-Type-Options nosniff; add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";

View File

@@ -28,10 +28,13 @@ keystone_devel_distro_packages:
- libxslt-devel - libxslt-devel
- openldap-devel - openldap-devel
- python-devel - python-devel
- systemd-devel
- which - which
keystone_service_distro_packages: keystone_service_distro_packages:
- openstack-keystone - openstack-keystone
- python-systemd
- python3-systemd
- uwsgi - uwsgi
- uwsgi-plugin-python - uwsgi-plugin-python

View File

@@ -27,11 +27,14 @@ keystone_devel_distro_packages:
- libxml2-devel - libxml2-devel
- libxslt-devel - libxslt-devel
- openldap2-devel - openldap2-devel
- systemd-devel
- pkg-config
- python-devel - python-devel
- which - which
keystone_service_distro_packages: keystone_service_distro_packages:
- openstack-keystone - openstack-keystone
- python-systemd
- uwsgi - uwsgi
- uwsgi-python - uwsgi-python
@@ -92,6 +95,9 @@ keystone_apache_modules:
state: "present" state: "present"
- name: "headers" - name: "headers"
state: "present" state: "present"
# This can be enabled when Apache2.5+ is available
# - name: "mod_journald"
# state: "present"
keystone_nginx_conf_path: 'conf.d' keystone_nginx_conf_path: 'conf.d'

View File

@@ -25,13 +25,17 @@ keystone_devel_distro_packages:
- libjs-underscore - libjs-underscore
- libldap2-dev - libldap2-dev
- libsasl2-dev - libsasl2-dev
- libsystemd-dev
- libxslt1.1 - libxslt1.1
- libxslt1-dev - libxslt1-dev
- libxml2-dev - libxml2-dev
- pkg-config
- python-dev - python-dev
keystone_service_distro_packages: keystone_service_distro_packages:
- keystone - keystone
- python-systemd
- python3-systemd
- uwsgi - uwsgi
- uwsgi-plugin-python - uwsgi-plugin-python
@@ -78,6 +82,9 @@ keystone_apache_modules:
state: "present" state: "present"
- name: "headers" - name: "headers"
state: "present" state: "present"
# This can be enabled when Apache2.5+ is available
# - name: "mod_journald"
# state: "present
keystone_nginx_conf_path: "sites-available" keystone_nginx_conf_path: "sites-available"

View File

@@ -25,13 +25,17 @@ keystone_devel_distro_packages:
- libjs-underscore - libjs-underscore
- libldap2-dev - libldap2-dev
- libsasl2-dev - libsasl2-dev
- libsystemd-dev
- libxslt1.1 - libxslt1.1
- libxslt1-dev - libxslt1-dev
- libxml2-dev - libxml2-dev
- pkg-config
- python-dev - python-dev
keystone_service_distro_packages: keystone_service_distro_packages:
- keystone - keystone
- python-systemd
- python3-systemd
- uwsgi - uwsgi
- uwsgi-plugin-python - uwsgi-plugin-python
@@ -78,6 +82,9 @@ keystone_apache_modules:
state: "present" state: "present"
- name: "headers" - name: "headers"
state: "present" state: "present"
# This can be enabled when Apache2.5+ is available
# - name: "mod_journald"
# state: "present
keystone_nginx_conf_path: "sites-available" keystone_nginx_conf_path: "sites-available"