# Logs

> The server events recorded by MayaBot, to search, filter and export in the dashboard.

Source: https://docs.mayabot.eu/modules/logs

MayaBot records what happens in the server: a deleted message, a banned member, an edited role, someone joining a voice channel. There are 94 events in 13 categories. You view them in the server's **Logs** section, in the dashboard.

## Turning logs on

### Turn the module on

In **Config > Logs** turn on the **Logs** switch. The module starts off.

### Choose the events

Below the switch the events are grouped into categories: open a category to turn each event on or off. At first only the main ones are on: messages sent, edited and deleted, channels created, edited and deleted, channel permissions changed, roles created, edited and deleted. **Restore default events** goes back to this choice. An event you turn off is no longer recorded; logs already saved stay.

### Open the Logs

Press **Open Logs**, next to the switch, or **Logs** in the server menu. From then on MayaBot records the events that are on.

If you turn the module off MayaBot stops recording, but the logs already saved stay available until they [expire](#retention). The Logs show **Logs are off: new events are not recorded.**

## Who can see the Logs

Anyone with **Administrator**, **Manage Server** or **View Audit Log** in the server can open the Logs.

- The server owner and anyone with **Administrator** see every log.
- Everyone else sees the logs of the channels they can see on Discord, plus those without a channel, such as a member joining or a role being edited. Logs of channels they can't see, and of deleted channels, don't appear.
- Anyone with **View Audit Log** but not **Manage Server** can only view the Logs. In the [server list](https://docs.mayabot.eu/getting-started/dashboard#server-list) they find the server under **No permission**: with the **Logs** label: one click opens the Logs. The server's other pages show **You can only view this server's logs.** with the **Open Logs** button.

## The Logs page

Under the title you see how many logs the period has with the filters you chose. Then comes the **Logs overview**; below is the list of logs, with search and filters at the top.

### Period

You pick the period at the top right of the **Logs overview**: the page starts on **24 hours**, and there are also **15 min**, **1 hour**, **7 days** and **30 days**. Periods longer than the server's [retention](#retention) have a crown and can't be chosen. The calendar button opens the **Custom range**: press a day to see only that day, or a second day for the range between them; then, if you like, the times in **From** and **To**, and **Apply**. Only days within the retention and since there are logs can be picked.

The **Logs overview** counts the period's logs by type (**Messages**, **Members**, **Voice channels**, **Channels and threads**, **Roles**, **Other**) and shows them in a column chart over time, like the server's **Activity overview**. Hover over a column to see the numbers. Use the mouse wheel on the chart to zoom into the stretch under the cursor: when you stop, the period becomes that stretch, the chart shows finer columns (hours, then minutes) and the list is filtered. Press a column to see only that day, hour or those minutes. Scrolling the wheel down widens the period again, up to everything that is kept.

### Searching

Type at least 2 characters in the **Search logs** field. The search looks at message text, also before and after an edit, reasons, and the names of users, channels, roles, emojis and attachments. Case and accents don't matter. A user, channel, message or log ID finds the logs that contain it.

If the search hasn't covered the whole period, **Search further back** appears at the bottom of the list.

### Filters

| Filter | What it shows |
|---|---|
| **Events** | The chosen categories or single events. Next to each one is how many logs it has in the period |
| **User** | The logs where a person acted or is involved. Find them by name or ID |
| **Done by** | Only the actions done by that person |
| **Channel** | The logs of the chosen channels, up to 40 |

**Clear filters** removes every filter and the search. Period, search, filters and order stay in the page address: you can save it or send it to someone who can see the Logs.

### List

Logs are grouped by day: **Today**, **Yesterday**, then the date. Each row says which event happened and in which channel, who acted and the details, such as the message text. If the action concerns someone else, an arrow points from whoever acted to them. On the right you see how long ago and the time, with seconds.

- The button at the top right of the list, next to the search, changes the order: **Newest** or **Oldest**.

The list loads more logs as you scroll, up to 5,000 rows: to go further, narrow the period or the filters, or export. At the bottom, **There are no more logs in this period.** means you've seen them all.

### New logs in real time

With **Live** on, as it is when the page opens, new logs arrive while you watch: the green dot means it's connected, **Reconnecting…** that it's connecting again. Press the button to set it to **Paused**. New logs don't enter the list right away: a button such as **3 new logs** appears at the top and shows them. With a **Custom range** or with the **Oldest** order, live updates are **Paused**: press the button to go back to the last period you chose, newest first.

### Log details

Press a row to open its details. They contain:

- event, category, date and time;
- **User**, **By**, **Channel**, **Thread** and the event's other data;
- the message preview as it looks on Discord: text, embeds or components; on a computer it sits to the left of the details, on a phone it opens with **Preview**;
- the message **Content**, or **Before** and **After** for an edited message;
- **Changes**: every field that changed, with its old and new value;
- **Attachments**, with name, type and size;
- **Open in Discord**, which takes you to the message;
- **All logs for this user** and **All logs for this channel**, which filter the list;
- **ID**: the IDs of the log, the user, whoever acted, the channel and the message, each with a button to copy it;
- **Raw data (JSON)**: all the log's data.

### Keyboard shortcuts

| Key | What it does |
|---|---|
| `/` | Goes to the search |
| `j` or down arrow | Selects the row below |
| `k` or up arrow | Selects the row above |
| **Enter** | Opens the details of the selected row |
| **Esc** | Closes the details, or clears the selection |

Shortcuts don't work while you're typing in a field.

### Exporting

**Export** downloads the logs of the period with the active search and filters, up to 50,000:

- **CSV file**: one row per log with time (in UTC), category, event, user, whoever acted, channel and details. Categories and events are in your language.
- **JSON file**: all the data of each log.

## Retention

| Plan | How long logs are kept |
|---|---|
| Free | 7 days |
| [Premium](https://docs.mayabot.eu/getting-started/premium) | 30 days |

In **Config > Logs**, under **Retention**, you can keep them for less time: from 4 days up to your plan's maximum. If you pick fewer days, older logs are deleted within an hour and cannot be recovered. **Reset** goes back to your plan's days.

- What counts is the plan active when the event is recorded: logs saved on the free plan are kept 7 days even if you turn on Premium later.
- When Premium ends, only the logs of the last 7 days remain.
- If MayaBot leaves the server, the logs are deleted after 7 days.

## What gets recorded

| Category | Events |
|---|---|
| **Messages** | Message sent, edited, deleted, bulk deleted, pinned, unpinned; reaction added and removed; reactions cleared, also for a single emoji |
| **Members** | Joined, left, kicked, banned, unbanned; timed out and timeout removed; nickname changed; roles added and removed; server avatar changed; membership screening passed; inactive members pruned |
| **Voice channels** | Joined, left, switched channel; server muted and server deafened (and the reverse); microphone and sound turned off or back on by the member; stream started and ended; camera on and off; disconnected or moved by a moderator |
| **Channels** | Channel created, deleted, updated; channel permissions updated; channels reordered |
| **Threads** | Thread created, deleted, updated, archived, reopened; member added and removed |
| **Roles** | Role created, deleted, updated; roles reordered |
| **Server and boosts** | Server updated; new boost; boost ended |
| **Emojis, stickers and sounds** | Added, updated, deleted |
| **Invites** | Invite created, deleted |
| **Webhooks, integrations and bots** | Webhook created, updated, deleted; integration added, updated, removed; bot added, bot removed |
| **Scheduled events** | Event created, updated, deleted, started, ended; subscription and unsubscription |
| **Stage** | Stage started, updated, ended |
| **AutoMod** | Rule created, updated, deleted; message blocked, alert, AutoMod timeout |

- Moderation actions (bans, kicks, timeouts, member roles and nicknames, pruned members, server mutes, disconnects and moves in voice channels, pinned messages) and changes to channels, threads, roles, the server, emojis, invites, webhooks, integrations, scheduled events and AutoMod rules come from Discord's audit log. They also say who acted and the reason, if one was written. Without **View Audit Log** MayaBot doesn't record them.
- Changes show the old and new value of each field that changed.
- A single action can give more than one log, as on Discord: a ban gives **Member banned** and **Member left**.
- For an edited or deleted message MayaBot only knows the earlier text if it saw the message, with logs on, in the last 3 days. Otherwise **Before** is **Unavailable** and the log of a deleted message has no **Content**.
- The log of a deleted message doesn't say who deleted it.
- MayaBot only records messages and reactions in the channels it can see. Its own messages and reactions aren't recorded.

## Permissions

| MayaBot's permission | Where | Why |
|---|---|---|
| **View Channel** | Channels to record | Messages and reactions only come from channels MayaBot can see |
| **View Audit Log** | Server | Moderation and server changes, with who acted and the reason |
| **Manage Server** | Server | AutoMod actions: blocked messages, alerts, timeouts |

If MayaBot is missing one of these permissions in the server, the [Overview](https://docs.mayabot.eu/getting-started/overview#missing-permissions) flags it and **Sync permissions** adds it.

## Common problems

| Problem | Fix |
|---|---|
| No logs | Check that **Logs** and the event you're looking for are on in **Config > Logs**, then widen the period or remove the filters |
| Bans, kicks, roles or channels are missing | MayaBot is missing **View Audit Log**: see [Missing permissions](https://docs.mayabot.eu/getting-started/overview#missing-permissions) |
| AutoMod actions are missing | MayaBot is missing **Manage Server** |
| A channel's messages are missing | MayaBot can't see that channel, or you can't: see [Who can see the Logs](#who-can-see-the-logs) |
| **Before** is **Unavailable** | The message is older than 3 days or was written while logs were off |
| **30 days** isn't among the periods | On the free plan logs are kept 7 days: see [Premium](https://docs.mayabot.eu/getting-started/premium) |
| A period is greyed out without a crown | Fewer **Retention** days were chosen in **Config > Logs** |
| **Live** changes period and order | With a **Custom range** or with **Oldest**, live updates are paused: pressing the button goes back to the last period, newest first |
| **Couldn't load the logs.** | Press **Retry**. If it keeps happening, check [status.mayabot.eu](https://status.mayabot.eu) |
