This document explain how to forward Apache error log to Apsolab-Server. There are 3 options for sending error log to Apsolab-Server.

  • Configure httpd to send error logs to syslog and configure syslog to forward logs to Apsolab-Server.
  • Configure httpd to save logs into a file and use [XLog-Parser + XLog-Agent] to forward logs to Apsolab-Server.
  • Configure httpd to pipe logs to [XLog-Parser + XLog-Agent] which will forward logs to Apsolab-Server (no logs file at all).

Option 1: Configure httpd to send error logs to syslog and configure syslog to forward logs to Apsolab-Server.

Locate and edit httpd.conf file. It is usually located under /etc/httpd/conf directory. In this file, locate ‘ErrorLog’ section. Change ErrorLog line for:

ErrorLog syslog

Then restart httpd service.
If syslog is not already configured to forward logs to Apsolab-Server, go to this document to configure rsyslog and this document to configure syslog-ng.

Option 2: Configure httpd to save logs into a file and use [XLog-Parser + XLog-Agent] to forward logs to Apsolab-Server.

Locate and edit httpd.conf file. It is usually located under /etc/httpd/conf directory. In this file, locate ‘ErrorLog’ section. Change ErrorLog line for:

ErrorLog logs/error_log

Then restart httpd service.
On RHEL, the error log file will be located under /var/log/httpd directory.
Create a shell script with the following content:

cd /opt/apsolab/latest/bin; (tail -n 0 -f /var/log/httpd/error_log) | (./xlogparser.pl -c=system -e=\[\] -f="[datetime],[priority],[host],msg") | (./xlogagent -d debug -t httpd_xlogagent.log -n Apache -z 2.2.15 -c http -a httpd -l httpd-{hostname} -x 127.0.0.1 -p 33200)

This option allows you to keep a local copy of httpd logs while sending everything to Apsolab-Server. But you will have to manage log rotation and find a way to start this script at boot time.

Option 3: Configure httpd to pipe logs to [XLog-Parser + XLog-Agent] which will forward logs to Apsolab-Server.

Locate and edit httpd.conf file. It is usually located under /etc/httpd/conf directory. In this file, locate ‘ErrorLog’ section. Change ErrorLog line for:

ErrorLog "|cd /opt/apsolab/latest/bin; (./xlogparser.pl -c=system -e=\[\] -f=\"[datetime],[priority],[host],msg\") | (./xlogagent -d debug -t httpd_xlogagent.log -n Apache -z 2.2.15 -c http -a httpd -l httpd-{hostname} -x 127.0.0.1 -p 33200)"

Then restart httpd service.
With this option there will be no local file with logs. So, no file rotation to manage and nothing special to handle at boot time. You can set LogLevel at debug in httpd.conf and control log threshold from Apsolab-Console (see Logger window).