From ed8d692fa9fe31d01f845f69e35cb4970296161a Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 17 Jul 2019 19:52:24 +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: Ib16362a8becb6666f36e5abdb93c548de2a269da --- defaults/main.yml | 1 + tasks/trove_pre_install.yml | 23 ----------------------- templates/trove.conf.j2 | 1 + vars/debian.yml | 1 + vars/redhat.yml | 1 + vars/suse.yml | 1 + 6 files changed, 5 insertions(+), 23 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 123f4e6..95d14ae 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -220,6 +220,7 @@ trove_pip_packages: - PyMySQL - python-troveclient - python-memcached + - systemd-python - trove trove_optional_oslomsg_amqp1_pip_packages: diff --git a/tasks/trove_pre_install.yml b/tasks/trove_pre_install.yml index 0e4c128..e31ae7b 100644 --- a/tasks/trove_pre_install.yml +++ b/tasks/trove_pre_install.yml @@ -59,26 +59,3 @@ when: - trove_use_mod_wsgi | bool - inventory_hostname in groups['trove_api'] - -- name: Test for log directory or link - shell: | - if [ -h "/var/log/trove" ]; then - chown -h {{ trove_system_user_name }}:{{ trove_system_group_name }} "/var/log/trove" - chown -R {{ trove_system_user_name }}:{{ trove_system_group_name }} "$(readlink /var/log/trove)" - else - exit 1 - fi - register: log_dir - failed_when: false - changed_when: log_dir.rc != 0 - -- name: Create trove log dir - file: - path: "{{ item.path }}" - state: directory - owner: "{{ item.owner|default(trove_system_user_name) }}" - group: "{{ item.group|default(trove_system_group_name) }}" - mode: "{{ item.mode|default('0755') }}" - with_items: - - { path: "/var/log/trove" } - when: log_dir.rc != 0 diff --git a/templates/trove.conf.j2 b/templates/trove.conf.j2 index 1092583..189b44d 100644 --- a/templates/trove.conf.j2 +++ b/templates/trove.conf.j2 @@ -1,6 +1,7 @@ # {{ ansible_managed }} [DEFAULT] debug = {{ debug }} +use_journal = true bind_host = {{ trove_service_host }} bind_port = {{ trove_service_port }} trove_api_workers={{ trove_api_workers }} diff --git a/vars/debian.yml b/vars/debian.yml index 550c5c7..27bc6d8 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -21,4 +21,5 @@ trove_distro_packages: - apache2 - apache2-utils - libapache2-mod-wsgi + - libsystemd-dev - qemu-utils diff --git a/vars/redhat.yml b/vars/redhat.yml index 8c09b66..70b05a8 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -21,4 +21,5 @@ trove_distro_packages: - httpd - httpd-tools - mod_wsgi + - systemd-devel - qemu-img diff --git a/vars/suse.yml b/vars/suse.yml index 3e105db..814a1bd 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -20,4 +20,5 @@ trove_distro_packages: - apache2 - apache2-utils - apache2-mod_wsgi + - systemd-devel - qemu-tools