mod_log_mysql Configuration Directives

If you are using version 1.10 or older, please see the old style directives.


MySQLLoginInfo

Syntax: MySQLLoginInfo host user password
Example: MySQLLoginInfo foobar.baz.com logwriter passw0rd
Context: server config

Defines the general parameters of the MySQL host to which you will be logging. host is the hostname or IP address of the MySQL machine. user is the MySQL userid (not a Unix userid!) with INSERT privileges on the table defined in MySQLTransferLogTable. password is that user's password. This is defined only once in the httpd.conf file.


MySQLDatabase

Syntax: MySQLDatabase database
Example: MySQLDatabase loggingdb
Context: server config

Defines the database that is used for logging. database must be operating on the MySQL host defined in MySQLLoginInfo. This is defined only once in the httpd.conf file.


MySQLTransferLogTable

Syntax: MySQLTransferLogTable table-name
Example: MySQLTransferLogTable access_log_table
Context: virtual host

Defines which table is used for logging of Apache's transfers; this is analogous to Apache's TransferLog directive. table-name must be a valid table within the database defined in MySQLDatabase.


MySQLRefererLogTable

Syntax: MySQLRefererLogTable table-name
Example: MySQLRefererLogTable refer_table
Context: virtual host

Usage of this directive is deprecated. Although it should still work, all mod_log_mysql users are encouraged to NOT log Referer and Agent separately.


MySQLAgentLogTable

Syntax: MySQLAgentLogTable table-name
Example: MySQLAgentLogTable agent_table
Context: virtual host

Usage of this directive is deprecated. Although it should still work, all mod_log_mysql users are encouraged to NOT log Referer and Agent separately.


MySQLRequestIgnore

Syntax: MySQLRequestIgnore req1 req2 req3 ... reqN
Example: MySQLRequestIgnore root.exe cmd.exe default.ida favicon.ico
Context: virtual host

Lists a series of strings that, if present in the URI, will cause that request NOT to be logged. This directive is useful for cutting down on log clutter when you KNOW that you do not want to log requests for certain objects. (The example above is a genuinely useful one; it will prevent logging of many common Microsoft-based worm intrusion attempts, as well as those ridiculous requests for the favicon.)

Each string is separated by a space, and NO regular expressions or globbing are allowed. Each string is evaluated as a substring of the URI using strstr().


MySQLRemhostIgnore

Syntax: MySQLRemhostIgnore host1 host2 host3 ... hostN
Example: MySQLRemhostIgnore localnet.com
Context: virtual host

Lists a series of strings that, if present in the REMOTE_HOST, will cause that request NOT to be logged. This directive is useful for cutting down on log clutter when you KNOW that you do not want to log requests from certain hosts, such as your own internal network machines.

Each string is separated by a space, and NO regular expressions or globbing are allowed. Each string is evaluated as a substring of the REMOTE_HOST using strstr().


MySQLRefererIgnore

Syntax: MySQLRefererIgnore ref1 ref2 ref3 ... refN
Example: MySQLRefererIgnore google.com
Context: virtual host

Lists a series of strings that, if present in the REFERER, will cause that request NOT to be logged. This directive is useful for cutting down on log clutter when you KNOW that you do not want to log requests from certain referers.

Each string is separated by a space, and NO regular expressions or globbing are allowed. Each string is evaluated as a substring of the REMOTE_HOST using strstr().


MySQLWhichCookie

Syntax: MySQLWhichCookie cookiename
Example: MySQLWhichCookie Apache
Default: None. You must set this if you wish to capture cookies.
Context: virtual host

If you have activated cookie logging in MySQLTransferLogFormat, then MySQLWhichCookie tells mod_log_mysql which cookie data to log. This is useful because many times you will be setting and receiving more than one cookie from a client; without this directive you'd be unable to choose which cookie is your mod_usertrack cookie.

Note: although this was intended for people using mod_usertrack to set usertracking cookies, you aren't restricted in any way. You can choose which cookie you wish to log to the database, and it doesn't necessarily have to have anything to do with mod_usertrack.


MySQLTransferLogFormat

Syntax: MySQLTransferLogFormat format-string
Example: MySQLTransferLogFormat huSUTv
Default: AbHhmRSsTUuv
Context: virtual host

Each character in the format-string defines an attribute of the request that you wish to log. The default logs the information required to create Combined Log Format logs, plus several extras. Here is the full list of allowable keys, which SOMETIMES resemble their Apache counterparts, but do not always:

CharacterWhat is this?MySQL DB fieldRecommended
column type
Example
AUser agentagentvarchar(255)Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0)
bBytes transferedbytes_sentint32561
cText of cookiecookievarchar(255)Apache=sdyn.fooonline.net.130051007102700823
f request_filevarchar(255) 
HHTTP request protocolrequest_protocolvarchar(10)HTTP/1.1
hName of remote hostremote_hostvarchar(50)blah.foobar.com
lIdent user inforemote_lognamevarchar(50)bobby
mHTTP request methodrequest_methodvarchar(6)GET
Phttpd child PIDchild_pidunsigned smallint3215
phttpd portserver_portunsigned smallint80
RRefererreferervarchar(255)http://www.biglinkstoyou.com/linkpage.html
rRequest in full formrequest_linevarchar(255)GET /books-cycroad.html HTTP/1.1
STime of request in UNIX formattime_stampunsigned int1005598029
sHTTP status of requeststatussmallint404
TSeconds to service requestrequest_durationsmallint2
tTime of request in human formatrequest_timechar(28)[02/Dec/2001:15:01:26 -0800]
uUser info from authremote_uservarchar(50)bobby
URequest in simple formrequest_urivarchar(255)/books-cycroad.html
vVirtual host servicing requestvirtual_hostvarchar(50)www.foobar.com

If you have compiled mod_log_mysql with WANT_SSL_LOGGING, you also get these:

CharacterMySQL DB field it activatesRecommended
column type
Example
zssl_ciphervarchar(25)RC4-MD5
qssl_keysizesmallint unsigned56
Qssl_maxkeysizesmallint unsigned128


Return to the mod_log_mysql homepage...