From 64fdc9d6854e3c55dc1880c15e918101fc885c05 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 16 Jul 2019 16:28:56 +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: Iaddb2c158a52d90025899d9bfa5576358bef92dd --- defaults/main.yml | 2 +- tasks/ironic_pre_install.yml | 23 ----------------------- templates/ironic-uwsgi.ini.j2 | 2 +- templates/ironic.conf.j2 | 1 + tests/os_ironic-overrides.yml | 1 - vars/debian.yml | 2 ++ vars/redhat-7.yml | 2 ++ vars/suse.yml | 2 ++ 8 files changed, 9 insertions(+), 26 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 0f474561..4afd7977 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -51,7 +51,6 @@ ironic_system_group_name: ironic ironic_system_shell: /bin/bash ironic_system_comment: ironic system user ironic_system_home_folder: "/var/lib/{{ ironic_system_user_name }}" -ironic_system_log_folder: "/var/log/{{ ironic_system_user_name }}" ironic_lock_path: /var/lock/ironic # Ironic Program and Service names @@ -193,6 +192,7 @@ ironic_pip_packages: - python-swiftclient - python-xclarityclient - sushy + - systemd-python - UcsSdk - uwsgi diff --git a/tasks/ironic_pre_install.yml b/tasks/ironic_pre_install.yml index 4b29e563..1d18e9e5 100644 --- a/tasks/ironic_pre_install.yml +++ b/tasks/ironic_pre_install.yml @@ -62,26 +62,3 @@ - { path: "/var/run/ironic" } - { path: "/var/www/cgi-bin", owner: root, group: root } - { path: "/var/www/cgi-bin/ironic" } - -- name: Test for log directory or link - shell: | - if [ -h "{{ ironic_system_log_folder }}" ]; then - chown -h {{ ironic_system_user_name }}:{{ ironic_system_group_name }} "{{ ironic_system_log_folder }}" - chown -R {{ ironic_system_user_name }}:{{ ironic_system_group_name }} "$(readlink {{ ironic_system_log_folder }} )" - else - exit 1 - fi - register: log_dir - failed_when: false - changed_when: log_dir.rc != 0 - -- name: Create ironic log dir - file: - path: "{{ item.path }}" - state: directory - owner: "{{ item.owner|default(ironic_system_user_name) }}" - group: "{{ item.group|default(ironic_system_group_name) }}" - mode: "{{ item.mode|default('0755') }}" - with_items: - - { path: "{{ ironic_system_log_folder }}" } - when: log_dir.rc != 0 diff --git a/templates/ironic-uwsgi.ini.j2 b/templates/ironic-uwsgi.ini.j2 index 252f5222..7c397e39 100644 --- a/templates/ironic-uwsgi.ini.j2 +++ b/templates/ironic-uwsgi.ini.j2 @@ -16,7 +16,7 @@ lazy-apps = true add-header = Connection: close buffer-size = {{ ironic_wsgi_buffer_size }} thunder-lock = true -logfile-chmod = 644 +disable-logging = true # Avoid filling up the logs with health check requests from haproxy. route-user-agent = ^osa-haproxy-healthcheck$ donotlog: diff --git a/templates/ironic.conf.j2 b/templates/ironic.conf.j2 index eb4cc2bf..1f24b626 100644 --- a/templates/ironic.conf.j2 +++ b/templates/ironic.conf.j2 @@ -3,6 +3,7 @@ [DEFAULT] # Disable stderr logging use_stderr = False +use_journal = True debug = {{ debug }} auth_strategy = {{ ironic_auth_strategy }} diff --git a/tests/os_ironic-overrides.yml b/tests/os_ironic-overrides.yml index 43838811..1f7d5067 100644 --- a/tests/os_ironic-overrides.yml +++ b/tests/os_ironic-overrides.yml @@ -31,7 +31,6 @@ neutron_network_device_mtu: 1500 neutron_l2_population: True neutron_dhcp_config: dhcp-option-force: "26,1500" - log-facility: "/var/log/neutron/neutron-dnsmasq.log" ironic_neutron_provisioning_network_name: "ironic-prov" neutron_l3: True neutron_metadata: True diff --git a/vars/debian.yml b/vars/debian.yml index 51fff512..9f01db2f 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -18,9 +18,11 @@ cache_timeout: 600 ironic_devel_distro_packages: - git-core - libffi-dev + - libsystemd-dev ironic_api_distro_packages: - libxml2-dev + - python-systemd ironic_conductor_distro_packages: - libxml2-dev diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index bda7ced2..3bec2d98 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -18,9 +18,11 @@ cache_timeout: 600 ironic_devel_distro_packages: - git-core - libffi-devel + - systemd-devel ironic_api_distro_packages: - libxml2-devel + - systemd-python ironic_conductor_distro_packages: - libxml2-devel diff --git a/vars/suse.yml b/vars/suse.yml index 3b02ab0a..40d14266 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -18,9 +18,11 @@ cache_timeout: 600 ironic_devel_distro_packages: - git-core - libffi-devel + - systemd-devel ironic_api_distro_packages: - libxml2-devel + - python-systemd ironic_conductor_distro_packages: - ipmitool