mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-29 12:14:26 -05:00
.. | ||
index.js | ||
mysql-schema.sql | ||
README.md | ||
SquadJS-Dashboard.json |
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 (This plugin has been tried with version 8.x.x, so it is suggested you use the same).
- You may need to enable a different authentication method for it to work. Follow this guide to learn how to do that.
- 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 theindex.js
file. - If you encounter any issues with this plugin, enable
debug: true
in themysql.createPool
constructor. This will cause errors to be logged to the console.
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);