To create new wiki account, please join us on #znc at freenode and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Difference between revisions of "ZLog SQL"

From ZNC
Jump to: navigation, search
Line 25: Line 25:
For SQLite use following string format:
For SQLite use following string format:
or simply leave out the path
or simply leave out the path

Latest revision as of 13:17, 13 September 2017

This is a global Python module for MySQL/SQLite logging.

GitHub repository:


  • Supports both MySQL and SQLite databases.
  • Asynchronous database writes on separate thread. Guarantees that ZNC won't hang during SQL connection timeout.
  • Automatic table creation (CREATE TABLE IF NOT EXIST)
  • Retry after failed inserts. When database server is offline, logs are buffered to memory. They are saved when database is back online, so you won't lose logs during MySQL outages.

Quick start[edit]

  1. Copy to ~/.znc/modules/
  2. In Webadmin, open the list of Global Modules.
  3. Make sure modpython is enabled.
  4. Enable module zlog_sql and set its argument.

For MySQL, set module argument matching following format:


Important: you need PyMySQL pip package for MySQL logging. Install it with pip3 install PyMySQL command.

For SQLite use following string format:


or simply leave out the path


in this case, logs are going to be written to the default path ~/.znc/moddata/zlog_sql/logs.sqlite.

  1. Save changes. SQL table schema is going to be created automatically.