Git Product home page Git Product logo

zlog-sql's Introduction

zlog-sql

MySQL/SQLite logging plugin for ZNC IRC bouncer written in Python 3

Features

  • Supports MySQL, PostgreSQL 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/PostgreSQL outages.

Some statistics

After having this plugin enabled for around 11 months, below are my statistics of MySQL table:

  • Total logs count: more than 4.87 million.
  • Space usage: 386 MB (data 270 MB, index 116 MB)

MySQL gives great compression ratio and is easily searchable. SQLite database doesn't support compression, but it's easier to setup and migrate.

Quick start

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

Screenshot

MySQL

For MySQL, set module argument matching following format:

mysql://username:password@localhost/database_name

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

PostgreSQL

For PostgreSQL, set module argument matching following format:

postgres://username:password@localhost/database_name

Important: you need psycopg2 pip package for PostgreSQL logging. Install it with pip3 install psycopg2 command.

SQLite

For SQLite use following string format:

sqlite:///home/user/logs.sqlite

or simply leave out the path

sqlite

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.

zlog-sql's People

Contributors

stil avatar bytesandcoffee avatar azimut avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.