Docs

Discord log

Everything that happens to your database in a Discord channel: what went wrong, what ran by itself, and every change an admin made in the panel.

Setting it up

  1. In Discord, pick a private channel for the log and open its settings (the gear next to its name) → Integrations → Webhooks → New Webhook, then press Copy Webhook URL.
  2. In game, open /sqlmenu → Maintenance → Settings → Discord log. Paste the URL, switch it on and press Save.
  3. Press Send test and check the channel.

The URL is stored in the database, in the waw_sql_settings table, and is never sent to a player or shown again in the panel. Only Discord webhook addresses are accepted.

A copy is kept in waw-sql-data/alerts.json on the server, because the "database is not answering" message has to go out exactly when the table cannot be read; whichever of the two was saved last is used. The table is left out of backups, so a backup file never carries the address.

What is sent

messagewhen it is sent
Panel actionevery change an admin makes in the panel: who did it, which action, and what they changed. The new value of an edited player row and the webhook address are never included
Backup takena manual or automatic backup finished: name, tables, rows, size and who took it
Backup restored / Restore failedthe result of a restore
Automatic backup faileda scheduled backup could not be taken
Old rows deleted / Cleanup faileda cleanup rule deleted old rows, or could not run
Schema updated / Schema update faileda script applied steps with MySQL.migrate, or a step failed
Smart alertsa script runs a query in a loop, runs one query per row, writes values into the query text or floods the database
Suspicious increasea number in an audited table rose by the set amount or more in a single change
Many queries are failing10 or more failed queries within a minute
Many slow queries10 or more slow queries within a minute
Very slow queryone query running 5 seconds or longer
Connection pool is fullqueries waiting 10 seconds or longer for a free connection
Database is not answering / is backthe database stops or resumes answering

Single queries are not logged to Discord: a busy server runs thousands per second and a webhook takes about 30 messages a minute. They are in the panel under Scripts → Queries instead.

Problem messages of the same kind are not repeated within 5 minutes (smart alerts: per script); panel actions and results are always sent.

Attaching backup files

With Attach backup file switched on in the same place, the .sql.gz file itself is attached to the "Backup taken" message, so every backup is also kept outside the server.

Discord accepts files up to 10 MB on a normal server, 50 MB at boost level 2 and 100 MB at boost level 3: pick yours in Discord file limit, which shows while Attach backup file is on. A larger backup is split and sent in parts, one per message: name.sql.gz.001, .002 and so on. To put it back together, download all parts into one folder and open the .001 file with 7-Zip, or run:

Console
copy /b name.sql.gz.001 + name.sql.gz.002 name.sql.gz

The result is the same file that is in the backup folder. Up to 10 parts are sent (waw_sql_discord_max_parts), so about 100 MB with the default limit; a larger backup is reported without the file. Keeping log tables small with cleanup rules keeps backups small too.

Use a private channel

This is off by default for a reason: the file holds all player data, and everyone who can read that channel can download it.

Language

The channel's language is picked in the panel: Maintenance → Settings → Discord log → Discord language. Choose the server's own language or any language the script has a file for. The whole message is written in it: title, field names and details. The panel's own log stays in the server's language.

Changing what is sent

Which messages are sent, these limits, the colours and who is pinged are all set in shared/webhook.lua. The wording comes from locales/<lang>.lua.

Text that comes from the game, such as a query or an error message, can never ping anyone, whatever it contains. If a query may contain player data you don't want in the channel, set showSql = false in shared/webhook.lua.