FiveHub è una piattaforma centralizzata per il monitoraggio, l’audit e la gestione operativa di server FiveM.
Centralizzazione dei log FiveM con ricerca, filtri per server e separazione multi‑tenant. Ideale per staff e audit.
Gestione sicura di immagini e audio generati in‑game (telefono, bodycam, CCTV simulati), con controllo accessi per server.
Supporto reale per più server FiveM (produzione, test, staging) con permessi separati per utenti e staff.
Accesso tramite Discord OAuth, senza password locali, con ruoli (admin, staff, viewer) gestiti lato server.
CSRF protection, session hardening, API key rotabili e isolamento completo dei dati tra server.
Tracciamento completo delle azioni amministrative (creazione server, rotazione API key, cancellazioni), con retention automatica.
FiveHub si integra nativamente con ox_lib e qbx_core come servizio di logging centralizzato, in modo analogo a FiveManage o Grafana Loki.
server.cfg
Configura FiveHub come servizio di logging impostando le seguenti convar.
# Enable ox_lib logger
set ox:logger "fivehub"
# Server API key (generated in FiveHub → Servers)
set fivehub:key "API_KEY_DEL_SERVER"
# Endpoint FiveHub (batch logging)
set fivehub:endpoint "https://fivehub.galad.it/api/logs/batch.php"
L’API key identifica in modo univoco il server FiveM ed è ruotabile in qualsiasi momento dalla dashboard FiveHub.
fivehub
FiveHub funziona come servizio di logging ox_lib.
È necessario aggiungere il seguente blocco in:
ox_lib/imports/logger/server.lua
if service == 'fivehub' then
local key = GetConvar('fivehub:key', '')
local endpoint = GetConvar('fivehub:endpoint', '')
if key ~= '' and endpoint ~= '' then
local buffer
local bufferSize = 0
local headers = {
['Content-Type'] = 'application/json',
['X-FIVEM-KEY'] = key,
['User-Agent'] = 'ox_lib',
}
local function flush()
PerformHttpRequest(endpoint, function(status, _, _, response)
if status ~= 200 then
print('[FiveHub] Log batch failed:', status, response)
end
end, 'POST', json.encode(buffer), headers)
buffer = nil
bufferSize = 0
end
function lib.logger(source, event, message, ...)
if not buffer then
buffer = {}
SetTimeout(500, flush)
end
local metadata = {
event = event,
source = source,
}
local player = source and exports.qbx_core:GetPlayer(source)
if player then
metadata.citizenid = player.PlayerData.citizenid
metadata.charname = player.PlayerData.charinfo.firstname
.. ' ' ..
player.PlayerData.charinfo.lastname
end
for _, arg in pairs({ ... }) do
if type(arg) == 'table' then
for k, v in pairs(arg) do
metadata[k] = v
end
elseif type(arg) == 'string' then
local k, v = string.strsplit(':', arg)
if k and v then
metadata[k] = v
end
end
end
bufferSize += 1
buffer[bufferSize] = {
level = 'info',
message = message,
resource = cache.resource,
metadata = metadata,
}
end
end
end
I log vengono inviati in batch ogni 500 ms per ridurre il carico e migliorare le prestazioni, esattamente come nei servizi SaaS di logging.
Una volta abilitato FiveHub come logger, è sufficiente utilizzare
lib.logger in qualsiasi resource server‑side:
lib.logger(source, 'vehicle:spawn', 'Vehicle spawned successfully')
Nel file di configurazione di NPWD modificare come segue.
"images": {
"url": "https://fivehub.galad.it/api/media/image.php",
"type": "image",
"imageEncoding": "webp",
"contentType": "multipart/form-data",
"useContentType": false,
"useWebhook": false,
"authorizationHeader": "Authorization",
"authorizationPrefix": "",
"useAuthorization": true,
"returnedDataIndexes": ["url"]
},
"voiceMessage": {
"enabled": true,
"authorizationHeader": "Authorization",
"url": "https://fivehub.galad.it/api/media/audio.php",
"returnedDataIndexes": ["url"]
},
Successivamente inserire le convar nel server.cfg.
set SCREENSHOT_BASIC_TOKEN "TOKENCODE"
set NPWD_AUDIO_TOKEN "TOKENCODE"
POST https://fivehub.galad.it/api/logs/batch.php – logging batch (ox_lib)POST https://fivehub.galad.it/api/logs/event.php – logging singolo (debug / test)Tutti i timestamp vengono generati lato FiveHub per garantire coerenza, correttezza e auditabilità.