From 002d2a91ea2dc0cb9a8147101afe419b0b58b531 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 15 Jul 2019 20:40:40 +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: I12c5a117d9ca508f24a36a477d2d71c36e6c8c96 --- defaults/main.yml | 1 + tasks/glance_install.yml | 2 -- templates/glance-api.conf.j2 | 2 +- templates/glance-cache.conf.j2 | 1 + templates/glance-manage.conf.j2 | 2 +- templates/glance-registry.conf.j2 | 2 +- templates/glance-scrubber.conf.j2 | 7 +------ templates/glance-uwsgi.ini.j2 | 2 +- vars/debian.yml | 2 ++ vars/redhat.yml | 2 ++ vars/suse.yml | 2 ++ 11 files changed, 13 insertions(+), 12 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6c8733c4..40e04ba2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -247,6 +247,7 @@ glance_pip_packages: - python-keystoneclient - python-memcached - python-swiftclient + - systemd-python - uwsgi - warlock diff --git a/tasks/glance_install.yml b/tasks/glance_install.yml index 2a738e27..c382ae49 100644 --- a/tasks/glance_install.yml +++ b/tasks/glance_install.yml @@ -113,8 +113,6 @@ - path: "{{ glance_system_user_home }}/scrubber" - path: "{{ glance_system_user_home }}/images" mode: "0755" - - path: "/var/log/glance" - mode: "0755" - name: Install distro packages package: diff --git a/templates/glance-api.conf.j2 b/templates/glance-api.conf.j2 index 283d1887..083cc4ec 100644 --- a/templates/glance-api.conf.j2 +++ b/templates/glance-api.conf.j2 @@ -4,7 +4,7 @@ # Disable stderr logging use_stderr = False debug = {{ debug }} -log_file = /var/log/glance/glance-api.log +use_journal = True fatal_deprecations = {{ glance_fatal_deprecations }} bind_host = {{ glance_api_bind_address }} bind_port = {{ glance_api_service_port }} diff --git a/templates/glance-cache.conf.j2 b/templates/glance-cache.conf.j2 index 48bdf4bb..8f182694 100644 --- a/templates/glance-cache.conf.j2 +++ b/templates/glance-cache.conf.j2 @@ -4,6 +4,7 @@ # Disable stderr logging use_stderr = False debug = {{ debug }} +use_journal = True admin_password = {{ glance_service_password }} admin_user = {{ glance_service_user_name }} admin_tenant_name = {{ glance_service_project_name }} diff --git a/templates/glance-manage.conf.j2 b/templates/glance-manage.conf.j2 index 8876cdb4..5d55fadf 100644 --- a/templates/glance-manage.conf.j2 +++ b/templates/glance-manage.conf.j2 @@ -2,7 +2,7 @@ # Disable stderr logging use_stderr = False debug = {{ debug }} -log_file = /var/log/glance/glance-manage.log +use_journal = True fatal_deprecations = {{ glance_fatal_deprecations }} [database] diff --git a/templates/glance-registry.conf.j2 b/templates/glance-registry.conf.j2 index 33887fc1..12a3dd7e 100644 --- a/templates/glance-registry.conf.j2 +++ b/templates/glance-registry.conf.j2 @@ -5,7 +5,7 @@ use_stderr = False debug = {{ debug }} fatal_deprecations = {{ glance_fatal_deprecations }} -log_file = /var/log/glance/glance-registry.log +use_journal = True bind_host = {{ glance_registry_bind_address }} bind_port = {{ glance_registry_service_port }} http_keepalive = {{ glance_http_keepalive }} diff --git a/templates/glance-scrubber.conf.j2 b/templates/glance-scrubber.conf.j2 index e3a5b7eb..0970ea6a 100644 --- a/templates/glance-scrubber.conf.j2 +++ b/templates/glance-scrubber.conf.j2 @@ -4,12 +4,7 @@ # Disable stderr logging use_stderr = False debug = {{ debug }} -# Log to this file. Make sure you do not set the same log file for both the API -# and registry servers! -# -# If `log_file` is omitted then log messages are -# sent to stdout as a fallback. -log_file = /var/log/glance/scrubber.log +use_journal = True # Should we run our own loop or rely on cron/scheduler to run us daemon = False diff --git a/templates/glance-uwsgi.ini.j2 b/templates/glance-uwsgi.ini.j2 index 70367c73..94eb3506 100644 --- a/templates/glance-uwsgi.ini.j2 +++ b/templates/glance-uwsgi.ini.j2 @@ -21,7 +21,7 @@ lazy-apps = true add-header = Connection: close buffer-size = {{ glance_wsgi_buffer_size }} thunder-lock = true -logfile-chmod = 644 +disable-logging = true http-auto-chunked = true http-raw-body = true socket-timeout = 10 diff --git a/vars/debian.yml b/vars/debian.yml index 58b63df2..b8816632 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -26,9 +26,11 @@ glance_distro_packages: glance_devel_distro_packages: - libxml2-dev + - libsystemd-dev glance_service_distro_packages: - python3-glance + - python3-systemd - uwsgi - uwsgi-plugin-python3 diff --git a/vars/redhat.yml b/vars/redhat.yml index a12a27ee..b86a2b9c 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -22,9 +22,11 @@ glance_distro_packages: glance_devel_distro_packages: - libxml2-devel + - systemd-devel glance_service_distro_packages: - openstack-glance + - systemd-python - uwsgi - uwsgi-plugin-python diff --git a/vars/suse.yml b/vars/suse.yml index 9b515184..3f1f891e 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -23,10 +23,12 @@ glance_distro_packages: glance_devel_distro_packages: - libxml2-devel + - systemd-devel glance_service_distro_packages: - openstack-glance - openstack-glance-api + - python-systemd - uwsgi - uwsgi-python