Skip to content
Last9 named a Gartner Cool Vendor in AI for SRE Observability for 2025! Read more →
Last9

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
  1. Apache Server Setup

    Install and configure Apache HTTP Server:

    # Install apache
    sudo apt-get update
    sudo apt-get install -y apache2
    sudo systemctl start apache2
    # Verify installation
    sudo systemctl status apache2

    Configure Apache Server:

    sudo nano /etc/apache2/apache2.conf

    Add the below configuration in the conf file:

    <Location "/server-status">
    SetHandler server-status
    Require host localhost
    </Location>

    Restart Apache:

    # Restart apache2
    sudo systemctl restart apache2
  2. Install OpenTelemetry Collector

    Download and install the OpenTelemetry Collector:

    sudo apt-get update
    sudo apt-get -y install wget systemctl
    wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.110.0/otelcol-contrib_0.110.0_linux_amd64.deb
    sudo dpkg -i otelcol-contrib_0.110.0_linux_amd64.deb
  3. Configure OpenTelemetry Collector

    Create the collector configuration:

    sudo nano /etc/otelcol-contrib/config.yaml

    Use 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: true
    retry_on_failure:
    enabled: true
    otlp:
    protocols:
    grpc:
    endpoint: 127.0.0.1:4318
    http:
    endpoint: 127.0.0.1:4319
    apache:
    endpoint: "http://localhost:80/server-status?auto"
    collection_interval: 10s
    processors:
    batch:
    timeout: 5s
    send_batch_size: 10000
    send_batch_max_size: 10000
    resourcedetection/ec2:
    detectors: ["ec2"]
    ec2:
    # A list of regex's to match tag keys to add as resource attributes can be specified
    tags:
    # 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: ignore
    log_statements:
    - context: resource
    statements:
    # 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: datapoint
    statements:
    - 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: detailed
    service:
    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]
  4. Start OpenTelemetry Collector

    Start the collector with the configuration:

    otelcol-contrib --config /etc/otelcol-contrib/config.yaml

Verification

To verify the setup is working:

  1. Check that Apache is serving the status endpoint:

    curl http://localhost/server-status?auto
  2. Verify the collector is running and collecting metrics

  3. Log into your Last9 account to confirm data is being received

Need Help?

If you encounter any issues or have questions: