Start your 14-day free trial today & Get 20% Off All Annual Managed ELK Plans

No Credit Card Required

Try Free

Already have an account? Sign In

Send data via Apache to your Logstash instance provided by

Apache Logstash Configuration

Ship Apache access and error logs to logstash

Configure Filebeat to ship logs from Apache to Logstash and Elasticsearch.

Step 1 - Install FilebeatCopy

deb (Debian/Ubuntu/Mint)

curl -L -O
sudo dpkg -i -oss-7.8.1-amd64.deb

rpm (CentOS/RHEL/Fedora)

curl -L -O
sudo rpm -vi -oss-7.8.1-x86_64.rpm


curl -L -O
tar xzvf -oss-7.8.1-darwin-x86_64.tar.gz


  • Download the Windows zip file from the official downloads page.
  • Extract the contents of the zip file into C:\Program Files.
  • Rename the -<version>-windows directory to ``.
  • Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select Run As Administrator). If you are running Windows XP, you may need to download and install PowerShell.
  • Run the following commands to install as a Windows service:
cd 'C:\Program Files\'
If script execution is disabled on your system, you need to set the execution policy for the current session to allow the script to run. For example: PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-.ps1.
My OS isn't here! Don't see your system? Check out the official downloads page for more options (including 32-bit versions).

Step 2 - Enable the Apache2 moduleCopy

There are several built in filebeat modules you can use. You will need to enable the apache2 module.


sudo filebeat modules list
sudo filebeat modules enable apache2


./filebeat modules list
./filebeat modules enable apache2


.\filebeat.exe modules list
.\filebeat.exe modules enable apache2

Additional module configuration can be done using the per module config files located in the modules.d folder, most commonly this would be to read logs from a non-default location

deb/rpm /etc/filebeat/modules.d/
mac/win <EXTRACTED_ARCHIVE>/modules.d/

Step 3 - Locate the configuration fileCopy

deb/rpm /etc/filebeat/filebeat.yml
mac/win <EXTRACTED_ARCHIVE>/filebeat.yml

Step 4 - Configure outputCopy

We'll be shipping to Logstash so that we have the option to run filters before the data is indexed.
Comment out the elasticsearch output block.

## Comment out elasticsearch output
#  hosts: ["localhost:9200"]
No input available! Your stack is missing the required input for this data source Talk to support to add the input

Step 5 - Validate configurationCopy

Let's check the configuration file is syntactically correct by running directly inside the terminal. If the file is invalid, will print an error loading config file error message with details on how to correct the problem.


sudo  -e -c /etc//.yml


./ -e -c .yml


.\.exe -e -c .yml

Step 6 - (Optional) Update Logstash FiltersCopy

All stacks come pre-configured with popular Logstash filters. We would recommend that you add Apache specific filters if you don't already have them, to ensure enhanced dashboards and modules work correctly.

Edit your Logstash filters by choosing Stack > Settings > Logstash Filters

if [fileset][module] == "apache2" {
  if [fileset][name] == "access" {
    grok {
      match => { "message" => ["%{IPORHOST:[apache2][access][remote_ip]} - %{DATA:[apache2][access][user_name]} \[%{HTTPDATE:[apache2][access][time]}\] \"%{WORD:[apache2][access][method]} %{DATA:[apache2][access][url]} HTTP/%{NUMBER:[apache2][access][http_version]}\" %{NUMBER:[apache2][access][response_code]} %{NUMBER:[apache2][access][body_sent][bytes]}( \"%{DATA:[apache2][access][referrer]}\")?( \"%{DATA:[apache2][access][agent]}\")?",
        "%{IPORHOST:[apache2][access][remote_ip]} - %{DATA:[apache2][access][user_name]} \\[%{HTTPDATE:[apache2][access][time]}\\] \"-\" %{NUMBER:[apache2][access][response_code]} -" ] }
      remove_field => "message"
    mutate {
      add_field => { "read_timestamp" => "%{@timestamp}" }
    date {
      match => [ "[apache2][access][time]", "dd/MMM/YYYY:H:m:s Z" ]
      remove_field => "[apache2][access][time]"
    useragent {
      source => "[apache2][access][agent]"
      target => "[apache2][access][user_agent]"
      remove_field => "[apache2][access][agent]"
    geoip {
      source => "[apache2][access][remote_ip]"
      target => "[apache2][access][geoip]"
  else if [fileset][name] == "error" {
    grok {
      match => { "message" => ["\[%{APACHE_TIME:[apache2][error][timestamp]}\] \[%{LOGLEVEL:[apache2][error][level]}\]( \[client %{IPORHOST:[apache2][error][client]}\])? %{GREEDYDATA:[apache2][error][message]}",
        "\[%{APACHE_TIME:[apache2][error][timestamp]}\] \[%{DATA:[apache2][error][module]}:%{LOGLEVEL:[apache2][error][level]}\] \[pid %{NUMBER:[apache2][error][pid]}(:tid %{NUMBER:[apache2][error][tid]})?\]( \[client %{IPORHOST:[apache2][error][client]}\])? %{GREEDYDATA:[apache2][error][message1]}" ] }
      pattern_definitions => {
        "APACHE_TIME" => "%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}"
      remove_field => "message"
    mutate {
      rename => { "[apache2][error][message1]" => "[apache2][error][message]" }
    date {
      match => [ "[apache2][error][timestamp]", "EEE MMM dd H:m:s YYYY", "EEE MMM dd H:m:s.SSSSSS YYYY" ]
      remove_field => "[apache2][error][timestamp]"

Step 7 - Start filebeatCopy

Ok, time to start ingesting data!


sudo systemctl enable filebeat
sudo systemctl start filebeat




Start-Service filebeat

Step 8 - Apache Logging OverviewCopy

Apache (also known as Apache HTTP Server) is a popular open-source web server that manages incoming HTTP requests. The first edition of Apache was launched over twenty years ago in 1995 & has grown to power over 40% of websites globally. Just one of the reasons for its widespread adoption is due to its highly flexible and powerful features.

Apache produces access & error logs and as a server that manages HTTP requests, the tool generates a high amount of log data when used to monitor high traffic websites. This can be difficult to efficiently analyse without an Apache log viewer.

The error log is characterised as the most important log data you’ll want to analyse as part of your audits. It contains a wealth of information beyond just errors & can be used for comprehensive diagnostic reporting. Access logs keep track of all access requests that have been sent to your web server and include data such as IP addresses, URLs & response times. provides a complete solution for fast Apache log viewing & analysis. Our platform’s built-in Apache log analyser saves on the need to configure numerous tools for the ingestion of Apache server logs as our hosted ELK Stack takes care of transforming, parsing, alerting, visualising & reporting in one centralised platform.

Followed our configuration file example for Apache and are still encountering issues? We're here to help. Reach out by contacting our team by visiting our dedicated Help Centre or via live chat & we'll be able to get back to you.

Toggle View

Expand View

Return to Search