diff --git a/defaults/main.yml b/defaults/main.yml index 8331ff31..57aea8f7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -154,7 +154,8 @@ horizon_server_name: "{{ ansible_fqdn | default('horizon') }}" horizon_apache_servertokens: "Prod" horizon_apache_serversignature: "Off" horizon_log_level: info -horizon_apache_custom_log_format: combined +# It's combined log format without datetime, since it's already present in journald +horizon_apache_custom_log_format: '"%h %l %u \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""' horizon_dropdown_max_items: 30 horizon_instance_log_length: 35 horizon_overview_days_range: 1 diff --git a/tasks/horizon_apache.yml b/tasks/horizon_apache.yml index eda66e4b..f9a53419 100644 --- a/tasks/horizon_apache.yml +++ b/tasks/horizon_apache.yml @@ -13,13 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Ensure apache log folder exists - file: - dest: "{{ horizon_apache_default_log_folder }}" - state: directory - owner: "{{ horizon_apache_default_log_owner }}" - group: "{{ horizon_apache_default_log_grp }}" - # NOTE(hwoarang): Module enable/disable process is only functional on Debian # and SUSE based systems. - name: Enable apache2 modules diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index f60180a9..9443b1c3 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -23,7 +23,6 @@ with_items: - { path: "/etc/pki/tls/certs", owner: "root", group: "root" } - { path: "/etc/pki/tls/private", owner: "root", group: "root" } - - { path: "/var/log/httpd", mode: "2755" } when: ansible_pkg_mgr in ['yum', 'dnf'] - name: Create system links @@ -34,7 +33,6 @@ with_items: - { src: "/etc/pki/tls/certs", dest: "/etc/ssl/certs" } - { src: "/etc/pki/tls/private", dest: "/etc/ssl/private" } - - { src: "/var/log/httpd", dest: "/var/log/apache2" } when: ansible_pkg_mgr in ['yum', 'dnf'] - name: Record the installation method diff --git a/tasks/horizon_install_source.yml b/tasks/horizon_install_source.yml index 7bd8c2d6..50e152ba 100644 --- a/tasks/horizon_install_source.yml +++ b/tasks/horizon_install_source.yml @@ -23,7 +23,6 @@ with_items: - { path: "/etc/pki/tls/certs", owner: "root", group: "root" } - { path: "/etc/pki/tls/private", owner: "root", group: "root" } - - { path: "/var/log/httpd", mode: "2755" } when: ansible_pkg_mgr in ['yum', 'dnf'] - name: Create system links @@ -34,7 +33,6 @@ with_items: - { src: "/etc/pki/tls/certs", dest: "/etc/ssl/certs" } - { src: "/etc/pki/tls/private", dest: "/etc/ssl/private" } - - { src: "/var/log/httpd", dest: "/var/log/apache2" } when: ansible_pkg_mgr in ['yum', 'dnf'] - name: Install the python venv diff --git a/tasks/horizon_pre_install.yml b/tasks/horizon_pre_install.yml index 34b6b888..85a0afd7 100644 --- a/tasks/horizon_pre_install.yml +++ b/tasks/horizon_pre_install.yml @@ -40,26 +40,3 @@ - { path: "/openstack/venvs", mode: "0755", owner: "root", group: "root" } - { path: "/etc/horizon", mode: "2750" } - { path: "{{ horizon_system_user_home }}", mode: "2755" } - -- name: Test for log directory or link - shell: | - if [ -h "/var/log/horizon" ]; then - chown -h {{ horizon_system_user_name }}:{{ horizon_system_group_name }} "/var/log/horizon" - chown -R {{ horizon_system_user_name }}:{{ horizon_system_group_name }} "$(readlink /var/log/horizon)" - else - exit 1 - fi - register: log_dir - failed_when: false - changed_when: log_dir.rc != 0 - -- name: Create horizon log dir - file: - path: "{{ item.path }}" - state: directory - owner: "{{ item.owner|default(horizon_system_user_name) }}" - group: "{{ item.group|default(horizon_system_group_name) }}" - mode: "{{ item.mode|default('0755') }}" - with_items: - - { path: "/var/log/horizon" } - when: log_dir.rc != 0 diff --git a/templates/openstack_dashboard.conf.j2 b/templates/openstack_dashboard.conf.j2 index 8d8c0321..f8d8a899 100644 --- a/templates/openstack_dashboard.conf.j2 +++ b/templates/openstack_dashboard.conf.j2 @@ -17,8 +17,8 @@ ServerName {{ horizon_server_name }} LogLevel {{ horizon_log_level }} - ErrorLog /var/log/horizon/horizon-error.log - CustomLog /var/log/horizon/ssl_access.log {{ horizon_apache_custom_log_format }} + ErrorLog syslog:daemon + CustomLog "|/usr/bin/env logger -p daemon.info -t {{ horizon_system_service_name }}" {{ horizon_apache_custom_log_format }} Options +FollowSymLinks {% if (horizon_enable_ssl | bool) and not (horizon_external_ssl | bool) %} SSLEngine on diff --git a/vars/debian.yml b/vars/debian.yml index c53556e9..a873119e 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -38,9 +38,6 @@ horizon_service_distro_packages: - python3-pymysql horizon_apache_conf: "/etc/apache2/apache2.conf" -horizon_apache_default_log_folder: "/var/log/apache2" -horizon_apache_default_log_owner: "root" -horizon_apache_default_log_grp: "adm" horizon_apache_security_conf: "/etc/apache2/conf-available/security.conf" horizon_apache_site_available: "/etc/apache2/sites-available/openstack-dashboard.conf" @@ -53,6 +50,7 @@ horizon_apache_configs: horizon_apache_default_sites: - "/etc/apache2/sites-enabled/000-default.conf" - "/etc/apache2/conf-enabled/openstack-dashboard.conf" + - "/etc/apache2/conf-enabled/other-vhosts-access-log.conf" horizon_apache_modules: - name: "wsgi" diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml index 44b87ea2..45272363 100644 --- a/vars/redhat-7.yml +++ b/vars/redhat-7.yml @@ -46,9 +46,6 @@ horizon_service_distro_packages: - python-PyMySQL horizon_apache_conf: "/etc/httpd/conf/httpd.conf" -horizon_apache_default_log_folder: "/var/log/httpd" -horizon_apache_default_log_owner: "root" -horizon_apache_default_log_grp: "root" horizon_apache_security_conf: "{{ horizon_apache_conf }}" horizon_apache_configs: diff --git a/vars/suse.yml b/vars/suse.yml index a4977e69..0ac624fb 100644 --- a/vars/suse.yml +++ b/vars/suse.yml @@ -51,9 +51,6 @@ horizon_enable_heat_ui: False horizon_enable_octavia_ui: False horizon_apache_conf: "/etc/apache2/httpd.conf" -horizon_apache_default_log_folder: "/var/log/apache2" -horizon_apache_default_log_owner: "root" -horizon_apache_default_log_grp: "root" horizon_apache_security_conf: "{{ horizon_apache_conf }}" horizon_apache_configs: