Send logs from the fxvault resource

Log from your own scripts with exports, and let the fxvault resource log common server events for you.

Media Storage1 min read

The fxvault resource can send logs from your own scripts, and log common server events for you. Lines go out in the background in batches and are retried, so logging never slows the server. Up to 20,000 lines or 16 MB wait if the service cannot be reached.

Logs need version 1.1.0 or later of the resource. 1.2.0 adds the performance monitor, and the current download, 1.2.1, also takes ox_lib's logs and sends them on with retries: see Send logs from ox_lib.

  1. Download the resource

    Unzip it into your resources folder.

    https://api.fxvault.link/dl/fxvault.zip
  2. Add the key and the convars

    In server.cfg. Use set, never setr or sets, and keep the set lines above ensure fxvault: inventory logging registers as fxvault starts, so a convar set after it is missed until a restart.

    Config
    set fxvault:key "fxv_..."
    # Or a separate key for logs, with Send logs:
    # set fxvault:logsKey "fxv_..."
    # Automatic events, each off until named: players, txadmin, inventory, deaths, resources, chat ("all" is every group but chat)
    # set fxvault:logs:events "players,txadmin,inventory"
    # Only to send logs to another address; unset, they go to logs.fxvault.link
    # set fxvault:logsApi "https://logs.fxvault.link"
    ensure fxvault
    • fxvault:key needs Send logs to send logs. When fxvault:logsKey is set, it is used for logs instead.
    • fxvault:logsApi is a base address, never a key, and only changes where logs go.
    • Turning an event group on both in fxvault:logs:events and in fmsdk's config.json stores each event twice.
  3. Log from your scripts

    The first argument is the dataset. playerSource adds that player's identifiers, read when the line is logged.

    Lua
    exports.fxvault:info("economy", "Ava paid 500 for a car", { playerSource = source, amount = 500 })
    exports.fxvault:log("anticheat", "warn", "Speed far above the limit", { playerSource = source, speed = 412 })

    The exports are log(dataset, level, message, meta), and debug, info, warn and error, which take the same arguments without the level.

  4. Check it

    Run fxvault status in the server console. It shows a logs line.

Automatic events

Each group is off until you name it in fxvault:logs:events. The groups are players, txadmin, inventory, deaths, resources and chat. all turns on every group except chat, which is only ever on by name.

Source: FiveM convars.

Need a server, or a hand with one?

Pick a plan to deploy a server, or open a ticket in the panel. Support runs 24/7/365.