:modulename: apache
:has-dashboards: true

== Apache module

The +{modulename}+ module parses access and error logs created by the
https://httpd.apache.org/[Apache HTTP] server.

include::../include/what-happens.asciidoc[]

include::../include/gs-link.asciidoc[]

[float]
=== Compatibility

The +{modulename}+ module was tested with logs from versions 2.2.22 and 2.4.23.

On Windows, the module was tested with Apache HTTP Server installed from the Chocolatey
repository.

include::../include/configuring-intro.asciidoc[]

The following example shows how to set paths in the +modules.d/{modulename}.yml+
file to override the default paths for Apache HTTP Server access and error logs:

["source","yaml",subs="attributes"]
-----
- module: apache
  access:
    enabled: true
    var.paths: ["/path/to/log/apache/access.log*"]
  error:
    enabled: true
    var.paths: ["/path/to/log/apache/error.log*"]
-----


To specify the same settings at the command line, you use:

["source","sh",subs="attributes"]
-----
-M "apache.access.var.paths=[/path/to/apache/access.log*]" -M "apache.error.var.paths=[/path/to/log/apache/error.log*]"
-----


//set the fileset name used in the included example
:fileset_ex: access

include::../include/config-option-intro.asciidoc[]

[float]
==== `access` log fileset settings

include::../include/var-paths.asciidoc[]

[float]
==== `error` log fileset settings

include::../include/var-paths.asciidoc[]

include::../include/timezone-support.asciidoc[]

[float]
=== Virtual Host

See customlog documentation  https://httpd.apache.org/docs/2.4/en/mod/mod_log_config.html
Add %v config in httpd.conf in log section
["source","sh",subs="attributes"]
-----
    # Replace
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    # By
    LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
-----

[float]
=== Example dashboard

This module comes with a sample dashboard. For example:

[role="screenshot"]
image::./images/kibana-apache.png[]

:has-dashboards!:

:fileset_ex!:

:modulename!:
