10. piw-logger¶
The piw-logger script is intended for use as an Apache “piped log script” but can also be used to feed pre-existing Apache logs to the master by feeding logs to the script’s stdin. This script must be run on the same node as the piw-master script.
10.1. Synopsis¶
piw-logger [-h] [--version] [-c FILE] [-q] [-v] [-l FILE]
[--format FORMAT] [--log-queue ADDR] [--drop]
[files [files ...]]
10.2. Description¶
-
files
¶
The log file(s) to load into the master; if omitted or “-” then stdin will be read which is the default for piped log usage
-
-h
,
--help
¶
Show this help message and exit
-
--version
¶
Show program’s version number and exit
-
-c
FILE
,
--configuration
FILE
¶ Specify a configuration file to load
-
-q
,
--quiet
¶
Produce less console output
-
-v
,
--verbose
¶
Produce more console output
-
-l
FILE
,
--log-file
FILE
¶ Log messages to the specified file
-
--format
FORMAT
¶ The Apache log format that log lines will be expected to be in (default: combined); the short-cuts common, combined and common_vhost can be used in addition to Apache LogFormat strings
-
--log-queue
ADDR
¶ The address of the queue used by piw-logger (default: (ipc:///tmp/piw-logger); this should always be an ipc address
10.3. Usage¶
This utility is typically used to pipe logs from a web-server, such as Apache into the piwheels database where they can be used for analysis, and to keep the stats on the homepage up to date. Apache provides a capability to pipe all logs to a given script which can be used directly with piw-logger.
A typical configuration under a Debian-like operating system might use the
Apache CustomLog directive as follows, within the Apache virtual host
reponsible for serving files to pip
clients:
ErrorLog ${APACHE_LOG_DIR}/ssl_error.log
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
CustomLog "|/usr/local/bin/piw-logger --drop" combined