Integration

Logging

Console, file and Discord logging: webhook groups, the event list, privacy switches and delivery.

Everything on this page is set in config_server.lua under ServerConfig.Logs. The settings table is on config_server.lua.

#Where events go

Output Controlled by
Console Logs.Console
logs/fx-phone-<yyyy-mm-dd>.log Logs.File. The last 7 days are kept
Discord The event's own webhook, else the group's entry in Logs.Webhooks

enabled = false on an event stops it everywhere. God admins can switch whole groups off on the admin tablet without a restart.

#One webhook per group

The quickest setup is one Discord channel per area. Put a webhook address next to each group you want in Discord and leave the others empty:

luaWebhooks = {
    phone = '',
    calls = '',
    messages = '',
    bank = '',
    invoices = '',
    media = '',
    social = '',
    marketplace = '',
    news = '',
    darkchat = '',
    sim = '',
    shop = '',
    admin = '',
},

An empty group is still written to the console (with Console = true) and the daily file, just not to Discord.

The group of an event is decided by the first part of its name:

Group Event prefixes
phone phone.
calls call.
messages message., group., cash.
bank bank., crypto.
invoices invoice.
media media., airdrop.
social account., post., comment., report., social.
marketplace listing.
news news.
darkchat channel.
sim sim.
shop shop.
admin admin.

Events with another prefix (appstore., mail., coins., cases., wallet., live.) have no group. They go to the console and the file, and to Discord only when the event has its own webhook.

#Events

Area Events
Phone phone.setup, phone.numberChanged, phone.wipe, phone.factoryReset, phone.unauthorized
Calls call.started, call.ended, call.missed, call.video
Messages message.sent, message.deleted, group.created, group.memberAdded, group.memberRemoved, group.left, cash.sent, cash.requested, cash.accepted
Bank bank.transfer, bank.invoicePaid, bank.move, bank.account, crypto.buy, crypto.sell, crypto.transfer
Invoices invoice.sent, invoice.paid, invoice.deleted
Media media.uploaded, media.deleted, airdrop.sent
Social account.created, account.login, account.passwordChanged, account.verified, account.unverified, post.created, post.deleted, comment.created, comment.deleted, report.created, social.match, social.goldPurchased
Marketplace listing.created, listing.deleted
News news.created, news.edited, news.deleted
Darkchat channel.created, channel.joined, channel.message
SIM sim.issued, sim.registered, sim.inserted, sim.ejected, sim.blocked, sim.unblocked, sim.reissued, sim.transferred
Shop shop.purchase, shop.duty, shop.restock, shop.price
Admin admin.opened, admin.appToggled, admin.settingChanged, admin.accountBanned, admin.accountUnbanned, admin.accountDeleted, admin.accountRestored, admin.credentialsChanged, admin.postDeleted, admin.postRestored, admin.commentDeleted, admin.listingDeleted, admin.userNumberSet, admin.userWiped, admin.userReset, admin.reportResolved, admin.channelClosed, admin.memberKicked, admin.backupCreated, admin.backupRestored, admin.simAction, admin.shopUpdated, admin.unauthorized
No group appstore.review_removed, mail.sent, coins.launch, coins.trade, coins.edit, cases.publish, cases.buy, cases.store, cases.resale, wallet.give, live.start, live.stop, live.gift

#Per event

luaEvents = {
    ['message.sent']  = { enabled = false, color = BLUE },   -- off everywhere
    ['bank.transfer'] = { enabled = true, color = GOLD, webhook = 'your-webhook-address' },   -- its own channel
}

enabled = false stops the event in the console, the file and Discord. webhook sends that event somewhere other than its group. color is the embed colour as a decimal number; the file defines BLUE, GREEN, ORANGE, RED, PURPLE, GOLD and GREY.

message.sent and channel.message are the loudest events: one entry per chat message. Most servers send them to the file only by leaving the messages and darkchat webhooks empty.

#Privacy switches

Setting Default What it does
ShowIp false IP in the file and as a Discord spoiler
ShowCoords true Player position
ShowTokens false Hardware tokens in the file, their count in Discord
DiscordBotToken empty A bot token lets the log show Discord usernames next to ids. Looked up once per 10 minutes

PINs, passwords, upload keys and webhook addresses are never logged. In the console a webhook appears as webhook#<id>.

#What an entry contains

A file line holds the time, the event name, a summary sentence, the context fields of the event, and an identity block for the player: FiveM name and server id, character name and identifier, job, linked identifiers, ping and, with ShowCoords, the position. A second identity block follows when the other player is online.

The Discord embed has the same content: title, summary, date as a Discord timestamp, context fields, the old and new values for changes, and the identity blocks. Mentions are disabled.

#Language

Log text comes from locales/<code>.json under logs.*. Logs.Locale = nil uses Config.Locale. Set Logs.Locale = 'en' to keep logs in English on a server with another default language.

Each event has logs.<event>.title and logs.<event>.summary keys you can change.

#Delivery

  • One queue per webhook address, about one message every 2 seconds.
  • Discord rate limits (429) are retried after the time Discord asks for, up to 5 times.
  • At most 150 messages wait per address. When the queue is full the oldest is dropped.
  • Dropped messages are counted in the console: [fx-phone:logs] webhook#123: log dropped (HTTP 404), 3 lost so far.
  • The file is written even when Discord is down.
  • A slow Discord never blocks a player's request.

#Files

logs/fx-phone-<yyyy-mm-dd>.log, one line per event, kept 7 days. The migration report is also saved in logs/.

#Audit log

Admin tablet actions are also written to an audit log in the database, kept for Config.Admin.AuditDays days. See Admin.