From 7d904743ef87257d67269bdd3a4669051cdb9203 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 15 Jul 2019 19:47:54 +0300 Subject: [PATCH] Use systemd-journald instead of log files This patch aims to migrate service from usage of regular syslog files to journald. We also disable uwsgi logging, since it dublicates requests that are logged by service itself. Change-Id: If1eda4d803661a0b924941aecd1867302391a5f4 --- defaults/main.yml | 2 +- tasks/nova_pre_install.yml | 28 ---------------------------- templates/nova-uwsgi.ini.j2 | 2 +- templates/nova.conf.j2 | 2 +- vars/debian.yml | 4 +++- vars/redhat-7.yml | 2 ++ vars/suse.yml | 2 ++ 7 files changed, 10 insertions(+), 32 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index aeeccb69..85a60ba2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -72,7 +72,6 @@ nova_system_shell: /bin/bash nova_system_comment: nova system user nova_system_home_folder: "/var/lib/{{ nova_system_user_name }}" nova_libvirt_save_path: "{{ nova_system_home_folder }}/save" -nova_log_dir: "/var/log/nova" nova_lock_path: "/var/lock/nova" @@ -529,6 +528,7 @@ nova_pip_packages: - python-memcached - python-novaclient - python-openstackclient + - systemd-python - uWSGI # Specific pip packages provided by the user diff --git a/tasks/nova_pre_install.yml b/tasks/nova_pre_install.yml index 201a27e9..20ad5408 100644 --- a/tasks/nova_pre_install.yml +++ b/tasks/nova_pre_install.yml @@ -124,34 +124,6 @@ tags: - nova-dirs -- name: Test for log directory or link - shell: | - if [ -h "{{ nova_log_dir }}" ]; then - chown -h {{ nova_system_user_name }}:{{ nova_system_group_name }} "{{ nova_log_dir }}" - chown -R {{ nova_system_user_name }}:{{ nova_system_group_name }} "$(readlink {{ nova_log_dir }})" - else - exit 1 - fi - register: log_dir - failed_when: false - changed_when: log_dir.rc != 0 - tags: - - nova-dirs - - nova-logs - -- name: Create nova log dir - file: - path: "{{ nova_log_dir }}" - state: directory - owner: "{{ nova_system_user_name }}" - group: "{{ nova_system_group_name }}" - mode: "0755" - when: - - log_dir.rc != 0 - tags: - - nova-dirs - - nova-logs - - name: Drop sudoers file template: src: "sudoers.j2" diff --git a/templates/nova-uwsgi.ini.j2 b/templates/nova-uwsgi.ini.j2 index e4cacdbc..186579ef 100644 --- a/templates/nova-uwsgi.ini.j2 +++ b/templates/nova-uwsgi.ini.j2 @@ -22,7 +22,7 @@ lazy-apps = true add-header = Connection: close buffer-size = {{ nova_wsgi_buffer_size }} thunder-lock = true -logfile-chmod = 644 +disable-logging = true pidfile = /var/run/{{ item.service_name }}/{{ item.service_name }}.pid # Avoid filling up the logs with health check requests from haproxy. diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index 5698e115..dcd63cd4 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -6,7 +6,7 @@ use_stderr = False # Logs / State debug = {{ debug }} fatal_deprecations = {{ nova_fatal_deprecations }} -log_dir = {{ nova_log_dir }} +use_journal = True state_path = {{ nova_system_home_folder }} rootwrap_config = /etc/nova/rootwrap.conf service_down_time = 120 diff --git a/vars/debian.yml b/vars/debian.yml index 8bbe2c6b..40ce892c 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -24,17 +24,19 @@ nova_distro_packages: - genisoimage - git - iptables - - python-openstackclient - libpython2.7 + - python-openstackclient nova_devel_distro_packages: - libpq-dev + - libsystemd-dev - libxml2-dev - python-httplib2 nova_service_distro_packages: - python3-nova - python3-memcache + - python3-systemd nova_service_extra_distro_packages: kvm: diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 6aaf146e..06455d9b 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -28,6 +28,7 @@ nova_distro_packages: nova_devel_distro_packages: - libxml2-devel - postgresql-devel + - systemd-devel - which nova_service_distro_packages: @@ -38,6 +39,7 @@ nova_service_distro_packages: - python-memcached - python-novaclient - python2-PyMySQL + - systemd-python nova_service_extra_distro_packages: kvm: diff --git a/vars/suse.yml b/vars/suse.yml index 97709339..7e475a13 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -30,6 +30,7 @@ nova_devel_distro_packages: - libxml2-devel - postgresql-devel - python-httplib2 + - systemd-devel nova_service_distro_packages: - openstack-nova-api @@ -38,6 +39,7 @@ nova_service_distro_packages: - python-memcached - python-novaclient - python-PyMySQL + - python-systemd nova_service_extra_distro_packages: kvm: