What Does Feathereye Do?

Created by Johnnie Walker
Keywords:
Last updated by:
Johnnie Walker

FeatherEye is a small, shell-wrapper, Linux CLI programme (written in PHP) that can be used to export information about Apache 2.2 configuration in a machine-readable format.

FeatherEye is currently very minimal in that it simply reads an Apache2 conf file, expanding Include directives, and outputs information about the logging directives.

It was originally written so that custom Apache log management scripts can automatically discover where the log files are located and which log format is being used. The aim was to avoid the need to duplicate information about such logging directives in a separate place (which would be likely to go out of synch if the Apache conf changed).

=== Search All Apache Conf Files to Find All Log Directives ===

# php list-apache-log-locations.php
/var/log/apache2/error.log
/var/log/apache2/other_vhosts_access.log
/var/log/apache2/access.log

When the 'list-apache-log-locations.php ' script is run, it will implictly execute the 'list-apache-conf-files.php' as a shell command (see below) which returns a list of apache conf file paths.

It then pipes the result through various linux filters to extract the values of any Apache directives of the type 'CustomLog', 'ErrorLog' or 'ForensicLog'.

We can then use this information as a starting point to perform other operations such as archiving old log files etc.

See:
* http://httpd.apache.org/docs/2.2/logs.html
* http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#customlog
* http://httpd.apache.org/docs/2.2/mod/core.html#errorlog
* http://httpd.apache.org/docs/2.2/mod/mod_log_forensic.html#forensiclog

=== List All the Conf Files Used by the System's Apache Deamon ===

# php list-apache-conf-files.php
/etc/apache2/apache2.conf
/etc/apache2/mods-enabled/alias.load
...

When the 'list-apache-conf-files.php' script is run, it will implictly execute the 'apache2 -V' shell command and extract the value of the SERVER_CONFIG_FILE build parameter. (This is likely to be '/etc/apache2/apache2.conf').

See : man apache2(8)

It then passes the value of SERVER_CONFIG_FILE to a service object which opens and reads that conf file and extracts all the Include directives from it (taking any 'ServerRoot' directives into consideration).

The service, then recursivly repeats the process for each 'Include directive' found inside those config files.

Ultimately, the service returns the list of paths to all Apache conf files that are included by SERVER_CONFIG_FILE.

Note: Apache allows 'pseudo file paths' (such as globs and directory-paths) to be used as values of Include directives. So, those are expanded to into lists of literal file paths.

See: http://httpd.apache.org/docs/2.2/mod/core.html#include