> ## Documentation Index
> Fetch the complete documentation index at: https://docs.redutzu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Logs

> Send MDT activity to Discord, Fivemanage, ox_lib, or a file.

The MDT logs what officers do: incidents filed, warrants issued, evidence changed, charges given, and more. Every log goes to two places:

* **The Logs page** inside the MDT, for officers with `logs.view`. It's always on.
* **One outside service** of your choice, set in `Config.Logs`.

![Logs page listing recent officer activity](https://mintcdn.com/redutzusscripts/jYySSRvwCjpWaAJk/images/guides/logs-page.webp?fit=max\&auto=format\&n=jYySSRvwCjpWaAJk\&q=85\&s=78c9d905b1911e767e93fb5a903f3cbf)

The Logs page in the MDT

## Choose a service

```lua config/config.lua theme={null}
Config.Logs = {
    Enabled = true,
    Service = 'discord', -- 'discord', 'fivemanage', 'ox_lib' or 'file'
    Dataset = 'default', -- fivemanage only
    RetentionDays = 0,
}
```

| Service | Where logs go | Setup |
| - | - | - |
| `'discord'` | Discord channels, as embeds | Webhooks in `credentials.lua` |
| `'fivemanage'` | Your Fivemanage dashboard, searchable | API key in `credentials.lua` |
| `'ox_lib'` | ox\_lib's logger (console, Fivemanage, Loki, Datadog) | Convars in `server.cfg` |
| `'file'` | `mdt-log-YYYY-MM-DD.log` in the resource folder | Nothing |

Set `Enabled = false` to stop sending logs out. The Logs page keeps working.

## Discord

Logs are split into categories. Each category can post to its own channel. Any category left `nil` posts to `default`.

**1. Create webhooks**

For each channel, open its settings, go to **Integrations**, then **Webhooks**, and click **New Webhook**. Copy the URL.

**2. Add them to credentials.lua**

```lua config/credentials.lua theme={null}
Config.Webhooks = {
    ['default'] = 'https://discord.com/api/webhooks/...',
    ['incidents'] = 'https://discord.com/api/webhooks/...',
    ['evidences'] = nil,
    ['warrants'] = nil,
    ['bolos'] = nil,
    ['citizens'] = nil,
    ['vehicles'] = nil,
    ['charges'] = nil,
    ['announcements'] = nil,
    ['images'] = nil
}
```

**3. Select Discord**

```lua config/config.lua theme={null}
Config.Logs = {
    Enabled = true,
    Service = 'discord',
    ...
}
```

![MDT log embed in a Discord channel](https://mintcdn.com/redutzusscripts/jYySSRvwCjpWaAJk/images/guides/logs-discord-embed.webp?fit=max\&auto=format\&n=jYySSRvwCjpWaAJk\&q=85\&s=25f24d67ae5820fdaca6680f76c911af)

A log posted to Discord

> [!TIP]
>
> Add a Discord bot token as `Config.ApiKeys.DiscordBotToken` to show each officer's real Discord avatar on the embeds. Without it, the MDT uses their Steam or Cfx.re avatar.

> [!NOTE]
>
> Discord allows about 30 messages a minute per webhook. The MDT queues logs and spaces them out, so nothing is lost on busy servers. Spreading categories across several webhooks makes them arrive faster.

## Fivemanage

[Fivemanage](https://refer.fivemanage.com/redutzu) stores your logs in one searchable dashboard. If you already use it for [media uploads](https://docs.redutzu.com/redutzu-mdt/guides/media-uploads.md), the same key works.

**1. Add your key**

```lua config/credentials.lua theme={null}
Config.ApiKeys = {
    Fivemanage = 'your-api-key',
    ...
}
```

**2. Select Fivemanage**

```lua config/config.lua theme={null}
Config.Logs = {
    Enabled = true,
    Service = 'fivemanage',
    Dataset = 'default',
    ...
}
```

`Dataset` is the Fivemanage dataset the logs are saved to. Use a separate one, such as `'mdt'`, to keep MDT logs apart from your other resources.

## ox\_lib

Sends every log through ox\_lib's logger. On its own, ox\_lib only prints logs to the server console. To send them somewhere, add one of these sets of convars to `server.cfg`:

```cfg Fivemanage theme={null}
set ox:logger "fivemanage"
set fivemanage:key "your-api-key"
```

```cfg Grafana Loki theme={null}
set ox:logger "loki"
set loki:user "your-user"
set loki:password "your-password"
set loki:endpoint "your-endpoint"
```

```cfg Datadog theme={null}
set ox:logger "datadog"
set datadog:key "your-api-key"
set datadog:site "datadoghq.com"
```

Use this service when your other resources already log through ox\_lib and you want everything in one place.

## File

Writes one plain-text file per day to the resource folder, such as `mdt-log-2026-11-02.log`. There's nothing to set up.

```text mdt-log-2026-11-02.log theme={null}
[2026-11-02 18:42:10] [SUCCESS] [incidents] John Doe (12) — Created incident #142
```

If nothing is written, check that the server can write to the resource folder. The console prints an error when it can't.

## Keep the Logs page small

The Logs page saves every entry in the `mdt_logs` table. On busy servers, set how many days to keep them:

```lua config/config.lua theme={null}
Config.Logs = {
    ...
    RetentionDays = 90, -- 0 = keep forever
}
```

This only cleans the MDT's own table. Logs already sent to Discord, Fivemanage, ox\_lib, or a file are never touched. You can also change it in `/mdtadmin`, under **Records**.

## Send logs anywhere

Every log fires the `redutzu-mdt:log:created` server event. Listen to it to send logs to your own service.

```lua server.lua theme={null}
AddEventHandler('redutzu-mdt:log:created', function(entry)
    print(entry.action, entry.message)
end)
```

The adapters in `server/custom/logs/` are complete examples.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.