Apache
Introduction
The Apache HTTP Server, commonly referred to as Apache, is an open-source web server software that serves as the foundation for the majority of websites on the internet.
Getting Started
Compatibility
The Apache O11ySource supports monitoring Apache HTTP Server versions 2.4.16 and later.
Data Collection Method
vuSmartMaps collects health metrics and logs through OmniAgent’s health and log collection probes.
Prerequisites
Inputs for Configuring Data Source
- Apache Server: The IP address or FQDN of the Apache server. This value uniquely identifies each server instance you add.
nan
- Period [in seconds]: How frequently data is gathered. The period should be between 60 and 3000 seconds.
- URL: The base URL of the Apache server hosting /server-status (for example, http://<host>:<port>).
- Access Log Path: Enter the full path to the Apache access log file.
- Error Log Path: Enter the full path to the Apache error log file.
Firewall Requirement
To collect data from this O11ySource, ensure the following ports are opened:
| Source IP | Destination IP | Destination Port | Protocol | Direction |
|---|---|---|---|---|
| IP address of the Apache server | vuSmartMaps Collection/Ingress node IP | 443* | TCP | Inbound |
*Before providing the firewall requirements, please update the port based on the customer environment.
Configuring the Target
Configure metrics collection from Apache
Apache metrics are collected by querying the server-status endpoint provided by mod_status.
Check whether mod_status is enabled:
apachectl -M | grep -i status
(For Debian/Ubuntu, you can also use:)
apache2ctl -M | grep -i status
Enable the status module (Debian/Ubuntu):
sudo a2enmod status
Configure /server-status access and enable ExtendedStatus.
Update the Apache configuration file as per your OS, for example:
-
- Debian/Ubuntu:
/etc/apache2/mods-enabled/status.conf
- Debian/Ubuntu:
-
- RHEL/CentOS:
/etc/httpd/conf.modules.d/*and/etc/httpd/conf/httpd.conf
- RHEL/CentOS:
Recommended for Apache 2.4+ (use Require):
<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Require ip <DATA_COLLECTOR_IP>
</Location>
</IfModule>
<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from <DATA_COLLECTOR_IP>
</Location>
</IfModule>
Reload Apache to apply changes:
apachectl -k graceful
(Or systemd)
sudo systemctl reload apache2
sudo systemctl reload httpd
From the collector/agent host (whose IP is included in the Require ip \<DATA_COLLECTOR_IP> rule), validate the endpoint:
curl -s http://<APACHE_HOST>:<PORT>/server-status?auto
Use https:// if your Apache status endpoint is TLS-enabled.
Configure log collection from Apache Apache logs are collected from access and error logs. Ensure Apache access/error logs are enabled and readable.
Common log locations:
-
- Debian/Ubuntu:
/var/log/apache2/access.log,/var/log/apache2/error.log
- Debian/Ubuntu:
-
- RHEL/CentOS:
/var/log/httpd/access_log,/var/log/httpd/error_log
- RHEL/CentOS:
Optional: If you need to customize log format, update the LogFormat section in the Apache configuration:
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
Example: Add request time (microseconds) using %D:
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %D" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %D" combined
Configuration Steps
Metrics Collected
| Name | Description | Data Type |
|---|---|---|
| @timestamp | The original string timestamp from the source log. | String |
| timestamp | The timestamp for the data point with high precision (64-bit). | DateTime64 |
| target | The target for the metrics, typically identifying the specific system or service being monitored. | String |
| host | Hostname of the server where the metrics were collected. | String |
| tenant_id | Tenant identifier for multi-tenant environments. | LowCardinality(String) |
| bu_id | Business Unit identifier for organizational grouping. | LowCardinality(String) |
| Type | Type of service being monitored (e.g., Apache, Nginx, etc.). | String |
| Uptime | Alias of uptime_server_uptime (backward compatibility). | Float64 |
| Status | Current status of the server or service (e.g., "Running", "Stopped"). | LowCardinality(String) |
| service_type | The type of service provided (e.g., HTTP, HTTPS). | String |
| source_id | Unique identifier for the source from which the metrics are collected. | String |
| service_address | The address of the service (e.g., IP address or URL). | String |
| vublock_name | Block name or virtual unit block within a larger system. | String |
| metricset_name | The name of the specific metric set (group of related metrics). | String |
| type | Type of data point being recorded (e.g., gauge, counter). | String |
| period | Time period for which the metrics are being collected (in seconds). | Float64 |
| topic_name | Name of the topic related to the metric, such as a specific service or function. | LowCardinality(String) |
| requests_per_sec | Number of HTTP requests per second. | Float64 |
| hostname | The hostname of the server where Apache is running. | String |
| uptime_uptime | Uptime of the current Apache process in seconds. | Float64 |
| uptime_server_uptime | Server uptime since the last restart in seconds. | Float64 |
| cpu_load | The current CPU load (the average amount of work the CPU has to do). | Float64 |
| cpu_user | The percentage of CPU time spent in user space. | Float64 |
| cpu_system | The percentage of CPU time spent in kernel space. | Float64 |
| cpu_children_user | CPU time spent by child processes in user mode. | Float64 |
| cpu_children_system | CPU time spent by child processes in kernel mode. | Float64 |
| cpu_system_diff | Difference in system CPU usage between the last two metric collections. | Float64 |
| cpu_system_rate | Rate of system CPU usage. | Float64 |
| cpu_user_diff | Difference in user CPU usage between the last two metric collections. | Float64 |
| cpu_user_rate | Rate of user CPU usage. | Float64 |
| scoreboard_waiting_for_connection | Number of workers waiting for a connection. | UInt64 |
| scoreboard_reading_request | Number of workers reading requests. | UInt64 |
| scoreboard_dns_lookup | Number of workers performing DNS lookups. | UInt64 |
| scoreboard_closing_connection | Number of workers closing connections. | UInt64 |
| scoreboard_gracefully_finishing | Number of workers gracefully finishing connections. | UInt64 |
| scoreboard_idle_cleanup | Number of workers cleaning up idle connections. | UInt64 |
| scoreboard_keepalive | Number of workers handling keep-alive connections. | UInt64 |
| scoreboard_total | Total number of scoreboard slots used. | UInt64 |
| scoreboard_logging | Number of workers writing log entries. | UInt64 |
| scoreboard_open_slot | Number of open slots in the scoreboard. | UInt64 |
| scoreboard_starting_up | Number of workers in the process of starting up. | UInt64 |
| scoreboard_sending_reply | Number of workers sending replies to clients. | UInt64 |
| load_15 | System load average over the last 15 minutes. | Float64 |
| load_1 | System load average over the last 1 minute. | Float64 |
| load_5 | System load average over the last 5 minutes. | Float64 |
| bytes_per_sec | The number of bytes served per second. | Float64 |
| connections_total | Total number of connections handled. | Float64 |
| connections_async_writing | Number of asynchronous writing connections. | Float64 |
| connections_async_keep_alive | Number of asynchronous keep-alive connections. | Float64 |
| connections_async_closing | Number of asynchronous closing connections. | Float64 |
| workers_busy | Number of busy workers at the time of data collection. | Float64 |
| workers_idle | Number of idle workers at the time of data collection. | Float64 |
| total_accesses | Total number of accesses (requests) made to the server. | Float64 |
| bytes_per_request | Average number of bytes per request. | Float64 |
| total_kbytes | Total number of kilobytes served. | Float64 |
| total_accesses_diff | Difference in the number of total accesses since the last metric collection. | UInt32 |
| total_kbytes_diff | Difference in total kilobytes served since the last metric collection. | UInt64 |
| total_kbytes_rate | Rate at which kilobytes are being served. | Float64 |
| total_cpu | Total CPU time used by the server. | Float64 |
| total_cpu_pct | Percentage of total CPU utilization. | Float64 |
| busy_workers_pct | Percentage of workers that are busy. | Float64 |
| idle_workers_pct | Percentage of workers that are idle. | Float64 |
| timestamp | The timestamp when the log entry was recorded with high precision (64-bit). | DateTime64 |
| target | The target for the log or metrics, usually the application or server. | String |
| host | The hostname of the server where the log was generated. | String |
| apache2_access_referrer | The URL of the referring page from where the request originated. | String |
| apache2_access_response_code | HTTP response code returned by the server (e.g., 200 for success, 404 for not found). | UInt64 |
| apache2_access_body_sent_bytes | Number of bytes sent in the response body. | UInt64 |
| apache2_access_url | The URL that was accessed by the client. | String |
| apache2_access_user_name | The username of the authenticated user (if available). | String |
| apache2_access_remote_ip | The IP address of the client making the request. | String |
| apache2_access_method | The HTTP method used for the request (e.g., GET, POST). | LowCardinality(String) |
| apache2_access_user_agent_name | Name of the user's browser or client application (user-agent). | String |
| apache2_access_user_agent_minor | Minor version number of the user-agent. | UInt64 |
| apache2_access_user_agent_os_name | Operating system of the client accessing the server. | String |
| apache2_access_tat | Turnaround time for the request (time taken to process the request, in seconds). | Float64 |
| apache2_access_user_agent_device | The type of device making the request (e.g., mobile, desktop). | LowCardinality(String) |
| httpCode | Alias of apache2_access_response_code (backward compatibility). | UInt64 |
| response | The response body or message returned by the server, if applicable. | String |
| geo_country_name | Geographical location of the client, specifically the country name. | String |
| geo_timezone | Timezone of the client’s geographical location. | String |
| geo_city_name | Geographical location of the client, specifically the city name. | String |
| doc_type | Type of document or log entry (e.g., access log, error log). | LowCardinality(String) |
| source_id | Unique identifier for the source of the log entry. | LowCardinality(String) |
| vublock_name | Name of the virtual block or unit block within the system. | LowCardinality(String) |
| o11ysource_name | Name of the observability source or platform collecting the logs (e.g., a monitoring tool or service). | LowCardinality(String) |
| tenant_id | Identifier for the tenant in multi-tenant environments. | LowCardinality(String) |
| bu_id | Business Unit identifier, typically for organizational purposes. | LowCardinality(String) |
| type | Type of log entry, representing different kinds of data points (e.g., access logs, error logs). | LowCardinality(String) |
| message | The full log message or entry. | String |
