InspIRCd v4 is still early in development!

If you use this branch you may experience crashes, weird behaviour, and unannounced breaking changes.

You probably want to use InspIRCd v3 instead.

The "log_sql" Module (v4)

Description

This module provides the ability to log to a SQL database.

Configuration

To load this module use the following <module> tag:

<module name="log_sql">

<log>

This module extends the core <log> tags with the following fields:

Name Type Default Value Description
method Text None Required! This MUST be set to sql to use SQL logging.
dbid Text None Required! The name of the database connection to execute the query against.
query Text INSERT INTO ircd_log (time, type, message) VALUES (FROM_UNIXTIME($time), '$type', '$message'); The query to use to insert a log message into the database.

The query field can contain any of the following template variables:

Variable Description
$level The log level as an integer.
$levelstr The log level as a string.
$message The log message.
$time The log time as a UNIX timestamp
$type The log message type.
Example Usage
<log method="sql"
     level="normal"
     type="* -USERINPUT -USEROUTPUT"
     dbid="sql-log"
     query="INSERT INTO ircd_log (time, type, message) VALUES (FROM_UNIXTIME($time), '$type', '$message');">

Special Notes

The following SQL modules are included with InspIRCd:

Engine Module Description
mysql mysql Queries a MySQL database.
pgsql pgsql Queries a PostgreSQL database.
sqlite3 sqlite3 Queries an SQLite database.

Example schemas for the server operator database are available in the sql subdirectory of the InspIRCd configuration directory. You can define your own schema as long as your query returns the required columns.