Server
lib.logger
lib.logger(source, event, message, ...)
- source:
number
orstring
- Preferably an active player id, otherwise an identifier, or wherever else it originated from.
- event:
string
- A name for the log event (i.e. the trigerring event or a description)
- message:
string
- The content for the log.
- vararg:
string
- Additional arguments are converted to tags for additional filtering and searching.
Example
local vehicle = Ox.CreateVehicle(false, `sultanrs`, vector4(-56.479122, -1116.870362, 26.432250, 0.000030517578))
lib.logger(-1, 'CreateVehicle', json.encode(vehicle))
Datadog
Create your Datadog (opens in a new tab) account
You will receive a free 14 day trial, otherwise refer to their pricing (opens in a new tab) guide.
Free accounts are limited, however logs will still be retained for 14 days.
Create an API key (opens in a new tab)
This is a UUID used to submit logs to your Datadog organisation.
Config
Set your API key and Datadog site (opens in a new tab) using the following convars.
set datadog:key "yourapikey"
set datadog:site "datadoghq.com"
Grafana Loki
Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus.
It is designed to be very cost effective and easy to operate.
- Has free tier with some restrictions
- Easy to manage
- Easier to setup
- Mostly managed by Grafana
Create your Grafana (opens in a new tab) account
Head to My Account (opens in a new tab)
Setup Loki
Find the Loki section in your account panel, and click "Details".
Generate a password and save the API key, as well as your user
and url
.
Config
Use the following convars to set your logging service, endpoint, and authentication details.
set ox:logger "loki"
set loki:user "<insert your user>"
set loki:password "<insert the api key or password>"
set loki:endpoint "<insert loki url without http:// or https://>"
Fivemanage
Fivemanage (opens in a new tab) is an easy-to-use, all-in-one SaaS for game servers that provides logging.
Create an account
Sign up at Fivemanage (opens in a new tab).
Make sure you have the Hobby
or Pro
plan.
You'll get a 14-days free trial if you do not already have an subscription, you can find more information here (opens in a new tab) and on the pricing (opens in a new tab) page.
Create a new token
You'll need to create a new token with the type Logs
.
Config
set ox:logger "fivemanage"
set fivemanage:key "YOUR_API_KEY"