mod_log_sql 2.0 Documentation

Home » Projects » Apache » Mod_log_sql » Docs-2.0 » mod_log_sql 2.0 Documentation

Up: How to tune logging with run-time directives --- Next: Instructing the module what NOT to log using filtering directives

Instructing the module what to log

The most basic directive for the module is LogSQLTransferLogFormat, which tells the module which information to send to the database; logging to the database will not take place without it. Place a LogSQLTransferLogFormat directive in the VirtualHost stanza of each virtual host that you want to activate.

After LogSQLTransferLogFormat you supply a string of characters that tell the module what information to log. In the configuration directive reference (section ) there is a table which clearly defines all the possible things to log. Let's say you want to log only the "request time," the "remote host," and the "request"; you'd use:

LogSQLTransferLogFormat hUS

But a more appropriate string to use is

LogSQLTransferLogFormat AbHhmRSsTUuv

which logs all the information required to be compatible with the Combined Log Format (CLF).

If you don't choose to log everything that is available, that's fine. Fields in the unused columns in your table will simply contain NULL.

Some of the LogSQLTransferLogFormat characters require a little extra configuration:

  • If you specify 'c' to indicate that you want to log the cookie value, you must also tell the module which cookie you mean by using LogSQLWhichCookie -- after all, there could be many cookies associated with a given request. Fail to specify LogSQLWhichCookie, and no cookie information at all will be logged.

  • If you specify 'M' to indicate that you want to log the machine ID, you must also tell the module this machine's identity using the LogSQLMachineID directive. Fail to specify LogSQLMachineID, and a simple '-' character will be logged in the machine_id column.