r/apache: log errors to syslog by default

Logging to syslog will allow messages to be aggregated in the central
server (Loki now, Victoria Logs eventually), so I don't have to SSH into
the web server to check for errors.
unifi-restore
Dustin 2025-08-04 09:47:39 -05:00
parent 84a8a0d4af
commit c35c7b8520
4 changed files with 22 additions and 2 deletions

View File

@ -1,6 +1,7 @@
apache_mpm: event apache_mpm: event
apache_keep_num_logs: 4 apache_keep_num_logs: 4
apache_max_log_size: 256M apache_max_log_size: 256M
apache_error_log: syslog:daemon
apache_ssl_protocol: apache_ssl_protocol:
- all - all
- '-SSLv2' - '-SSLv2'

View File

@ -5,6 +5,16 @@
tags: tags:
- install - install
- name: ensure global error log is configured
template:
src: errorlog.j2
dest: /etc/httpd/conf.d/00-errorlog.conf
owner: root
group: root
mode: u=rw,go=r
tags:
- apache-config
- name: ensure http service keytab is in place - name: ensure http service keytab is in place
copy: copy:
src={{ item }} src={{ item }}

View File

@ -0,0 +1,5 @@
{% if apache_error_log %}
ErrorLog {{ apache_error_log }}
{% else %}
# Use the default ErrorLog value set in httpd.conf
{% endif %}

View File

@ -1,7 +1,11 @@
# Use separate log files for the SSL virtual host; note that LogLevel # Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf. # is not inherited from httpd.conf.
ErrorLog logs/ssl_error_log {% if apache_ssl_error_log is defined %}
TransferLog logs/ssl_access_log ErrorLog {{ apache_ssl_error_log }}
{% endif %}
{% if apache_ssl_transferlog is defined %}
TransferLog {{ apache_ssl_transferlog }}
{% endif %}
LogLevel warn LogLevel warn
# SSL Engine Switch: # SSL Engine Switch: