Apache HTTP Server
Monitor Apache HTTP Server with OpenTelemetry collector to send metrics and logs to Last9
Use OpenTelemetry to monitor apache server metrics and send them to Last9.
Read the setup guide for more details.
Prerequisites
Before setting up Apache monitoring, ensure you have:
- Apache HTTP Server installed and running
- Administrative access to configure Apache
- OpenTelemetry Collector installation access
- Last9 account with integration credentials
-
Apache Server Setup
Install and configure Apache HTTP Server:
# Install apachesudo apt-get updatesudo apt-get install -y apache2sudo systemctl start apache2# Verify installationsudo systemctl status apache2Configure Apache Server:
sudo nano /etc/apache2/apache2.confAdd the below configuration in the conf file:
<Location "/server-status">SetHandler server-statusRequire host localhost</Location>Restart Apache:
# Restart apache2sudo systemctl restart apache2 -
Install OpenTelemetry Collector
Download and install the OpenTelemetry Collector:
sudo apt-get updatesudo apt-get -y install wget systemctlwget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.110.0/otelcol-contrib_0.110.0_linux_amd64.debsudo dpkg -i otelcol-contrib_0.110.0_linux_amd64.deb -
Configure OpenTelemetry Collector
Create the collector configuration:
sudo nano /etc/otelcol-contrib/config.yamlUse the following configuration for Otel Collector:
receivers:filelog:# File path pattern to read logs from. Update this to the destination from where you want to read logs.include: [/var/log/apache2/*.log]include_file_path: trueretry_on_failure:enabled: trueotlp:protocols:grpc:endpoint: 127.0.0.1:4318http:endpoint: 127.0.0.1:4319apache:endpoint: "http://localhost:80/server-status?auto"collection_interval: 10sprocessors:batch:timeout: 5ssend_batch_size: 10000send_batch_max_size: 10000resourcedetection/ec2:detectors: ["ec2"]ec2:# A list of regex's to match tag keys to add as resource attributes can be specifiedtags:# This means you have a tag `Name` associated with the EC2 Instance.- ^Name$# This means you have a tag `app` associated with the EC2 Instance.- ^app$transform/ec2:error_mode: ignorelog_statements:- context: resourcestatements:# Set Service name as the `Name` tag associated with the EC2 Instance. The format is `ec2.tag.<tag_name>`.- set(attributes["service.name"], attributes["ec2.tag.Name"])resourcedetection/system:detectors: ["system"]system:hostname_sources: ["os"]transform/hostmetrics:metric_statements:- context: datapointstatements:- set(attributes["host.name"], resource.attributes["host.name"])- set(attributes["cloud.account.id"], resource.attributes["cloud.account.id"])- set(attributes["cloud.availability_zone"], resource.attributes["cloud.availability_zone"])- set(attributes["cloud.platform"], resource.attributes["cloud.platform"])- set(attributes["cloud.provider"], resource.attributes["cloud.provider"])- set(attributes["cloud.region"], resource.attributes["cloud.region"])- set(attributes["host.type"], resource.attributes["host.type"])- set(attributes["host.image.id"], resource.attributes["host.image.id"])exporters:otlp/last9:endpoint: "{{ .Logs.WriteURL }}"headers:"Authorization": "{{ .Logs.AuthValue }}"debug:verbosity: detailedservice:pipelines:logs:receivers: [filelog]processors: [resourcedetection/ec2, transform/ec2, batch]exporters: [otlp/last9]metrics:receivers: [apache]processors: [batch, resourcedetection/system, transform/hostmetrics]exporters: [otlp/last9, debug] -
Start OpenTelemetry Collector
Start the collector with the configuration:
otelcol-contrib --config /etc/otelcol-contrib/config.yaml
Verification
To verify the setup is working:
-
Check that Apache is serving the status endpoint:
curl http://localhost/server-status?auto -
Verify the collector is running and collecting metrics
-
Log into your Last9 account to confirm data is being received
Need Help?
If you encounter any issues or have questions:
- Join our Discord community for real-time support
- Contact our support team at support@last9.io