Apache (Combined)


Apache is the most widely used web server software. Developed and maintained by Apache Software Foundation, Apache is an open source software available for free.

Integration of Apache on Ubuntu with DNIF Adapter

To forward Apache logs to the DNIF Adapter make the following configuration

Log in to the server that hosts Apache, as the root user.

Install syslog package, if you haven’t installed it

$apt-get install rsyslog

Edit the Apache configuration file apache2.conf.

$vim /etc/apache2/apache2.conf

And check if following lines are available and uncommented:

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

Now, edit ../sites-enabled/000-default.conf [Or you Site configuration if name is manually assigned] and Add/Edit the following information in your Site configuration file to specify a custom path for the syslog events:

Note: For this Example we are chosing local1 and local2 as log facility. You can set you own localX based on availability.

Add the following information in the Apache configuration file to specify a custom path for the syslog events:

####For error logs
ErrorLog ${APACHE_LOG_DIR}/error.log
ErrorLog syslog:local1

####For access logs
CustomLog ${APACHE_LOG_DIR}/access.log combined
CustomLog "|/usr/bin/logger -t Apache -i -p local2.info" combined

Save the Apache configuration file.

Edit the syslog configuration file.

vim /etc/rsyslog.d/50-default.conf

Add the following information to syslog configuration file:

##For System logs
*.*		@DNIF-Adapter-IP:514

##For apache logs
local1.*	@DNIF-Adapter-IP:514
local2.*	@DNIF-Adapter-IP:514

Save the syslog configuration file.

Restart the rsyslog service.

 /etc/init.d/rsyslog restart

Restart Apache to complete the syslog configuration.

 /etc/init.d/apache2 restart

Apache logs are now being streamed to the DNIF-ADAPTER.

Integration of Apache on CentOS-RHEL with DNIF Adapter

To forward Apache logs to the DNIF Adapter make the following configuration.

Log in to the server that hosts Apache, as the root user.

Install syslog package, if you haven’t installed it

yum -y install rsyslog

Edit the configuration file httpd.conf:

vim /etc/httpd/conf/httpd.conf

Add the following information in the http configuration file to specify a custom path for the syslog events:

####For error logs
ErrorLog logs/error_log
ErrorLog syslog:local1

####For access logs
CustomLog logs/access_log combined
CustomLog "|/usr/bin/logger -t httpd -p local2.info" combined

Save the Apache configuration file.

Edit the syslog configuration file:

vim /etc/rsyslog.conf

Add the following information to syslog configuration file:

##For System logs
*.*		@DNIF-Adapter-IP:514

##For apache logs
local1.*	@DNIF-Adapter-IP:514
local2.*	@DNIF-Adapter-IP:514

Save the syslog configuration file.

Restart the rsyslog service.

 /etc/init.d/rsyslog restart

Restart Apache to complete the syslog configuration.

 /etc/init.d/httpd restart

Apache logs are now being streamed to the DNIF-ADAPTER.