SquadJS/plugins/mysql-log
2020-05-21 22:04:16 +01:00
..
index.js Remove unused function names. 2020-05-21 22:04:16 +01:00
mysql-schema.sql SquadJS v1 2020-05-15 18:42:39 +01:00
README.md SquadJS v1 2020-05-15 18:42:39 +01:00

Logo

SquadJS - MySQL Log

About

The MySQL log plugin logs event information into a MySQL database to allow it to be queried for analysis, monitoring, or stat tracking. Works well with Grafana.

Requirements

  • MySQL database.
  • Execute the mysql-schema.sql in the database to setup the tables, etc.
  • Add your server to the database... INSERT INTO Server (name) VALUES ("[EU] The Coalition"); Please make sure the inserted ID is the same as that of the server in the index.js file.

Installation

// Place the following two lines at the top of your index.js file.
import mysql from 'mysql';
import { mysqlLog } from 'plugins';

// Place the following lines in your index.js file. Replace the credentials with the credentials of your MySQL database.
const mysqlPool = mysql.createPool({
connectionLimit: 10,
host: 'host',
port: 3306,
user: 'squadjs',
password: 'password',
database: 'squadjs'
});
mysqlLog(server, mysqlPool);