Use systemd-journald instead of log files

This patch aims to migrate apache from usage of regular syslog files
to journald.

Change-Id: Ifde6b86bec87fdd2fa161f8d28aed7f6ffa52f74
This commit is contained in:
Dmitriy Rabotyagov 2019-07-24 14:51:02 +03:00
parent 73aa4428b2
commit ef1c53fa88
9 changed files with 5 additions and 46 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -17,8 +17,8 @@
<VirtualHost *:{{ ((horizon_enable_ssl | bool) and not (horizon_external_ssl | bool)) | ternary('443', '80') }}>
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

View File

@ -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"

View File

@ -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:

View File

@ -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: