Skip to main content
Version: Cloud

Monitor Apache Server


Apache Server’s monitoring involves monitoring of the following elements:

  • Apache Access Logs
  • Apache Error Logs
  • Apache Server Health

The configurations given below apply only to the Apache server running on an instance.


  1. Ensure Apache access logs are in format expected by sfAgent parser.

    Edit configuration file , conf file can be /etc/apache2/apache2.conf, /etc/apache2/sites-enabled/000-default.conf, /etc/apache2/conf-enabled/other-vhosts-access-log.conf and set log format as follows:

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

    CustomLog "logs/access_log" combined 

    After configuring log format, the expected log entry would be: - - [28/Jun/2020:23:34:10 -0700] "GET / HTTP/1.1" 302 242 "-" "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36" 271  

    Apache configuration file can be found in these paths:

    • Ubuntu: /etc/apache2/mods-enabled/status.conf 
    • Centos: /etc/httpd/conf/httpd.conf
  2. Check if Apache status module is enabled

    This is required to monitor Apache server health.

    Apache web server exposes metrics through its status module, mod_status. If apache server is running and mod_status is enabled, apache server’s status page should be available at

    Alternatively, you can check is mod_status is enabled by running the following commands:

    Ubuntu(or Debian based systems):

    sudo apache2ctl -M | grep status_module  


    sudo httpd -M | grep status_module  

    if output of above command is status_module , then apache status module is enabled. If mod_status is not enabled , follow next step to enable it.

  3. Enable Apache status module

    In order to enable mod_status ,  edit the status module’s configuration file (on Debian platforms), or your main Apache configuration file (all other Unix-like platforms). 

    Debian users can find the status module’s configuration file in /etc/apache2/mods-enabled/status.conf 

    Users of other platforms (such as Red Hat–based systems) will find their main configuration file in /etc/apache2/apache2.conf, /etc/httpd/conf/httpd.conf, or /etc/apache2/httpd.conf. 

     In the main configuration file, allow access from local or from a specific ip address as shown below:  

       <Location /server-status>  
           SetHandler server-status 
           Require local 
     #     Require all granted 
           Require ip x.x.x.x 

    Check your configuration file for errors with the following command:

    apachectl configtest   

    Perform a graceful restart to apply the changes without interrupting live connections:

    (apachectl -k graceful or service apache2 graceful)  

    After enabling mod_status and restarting Apache, status page is accessible at http://localhost/server-status  or http://ipaddress/server-status.


sfAgent section provides steps to install and automatically generate plugin configurations. User can also manually add the configuration shown below to config.yaml under /opt/sfagent/ directory

key: <profile key> 
generate_name: true
Name: <unique instance name or will be generated from IP>
appName: <add application name>
projectName: <add project name>
- name: apache
enabled: true
interval: 300
port: <apache port number>
secure: false ## while using secured connection set secure flag to true
location: server-status
- name: apache-access
enabled: true
geo_info: true
log_path: /var/log/apache2/access.log, var/log/apache2/access_log
ua_parser: false
- name: apache-error
enabled: true
- notice
- warning
- error
log_path: /var/log/apache2/error.log, /var/log/httpd/error_log

Viewing data and dashboards

Data generated by plugin can be viewed in browse data page inside the respective application under plugin=apache and documentType=apache. Logger data is available inside plugin=apache-access with documentType=apacheAccess and plugin=apache-error with documentType=apacheError.

Dashboard for this data can be instantiated by Importing dashboard template Apache_Server and Apache_Access to the application dashboard.