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
- 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.
- In game, open
/sqlmenu→ Maintenance → Settings → Discord log. Paste the URL, switch it on and press Save. - 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
| message | when it is sent |
|---|---|
| Panel action | every 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 taken | a manual or automatic backup finished: name, tables, rows, size and who took it |
| Backup restored / Restore failed | the result of a restore |
| Automatic backup failed | a scheduled backup could not be taken |
| Old rows deleted / Cleanup failed | a cleanup rule deleted old rows, or could not run |
| Schema updated / Schema update failed | a script applied steps with MySQL.migrate, or a step failed |
| Smart alerts | a script runs a query in a loop, runs one query per row, writes values into the query text or floods the database |
| Suspicious increase | a number in an audited table rose by the set amount or more in a single change |
| Many queries are failing | 10 or more failed queries within a minute |
| Many slow queries | 10 or more slow queries within a minute |
| Very slow query | one query running 5 seconds or longer |
| Connection pool is full | queries waiting 10 seconds or longer for a free connection |
| Database is not answering / is back | the 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:
copy /b name.sql.gz.001 + name.sql.gz.002 name.sql.gzThe 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.
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.
