Docs

The server log

The server log

The server log posts changes made in a server as they happen: which invite each person joined with, roles given and taken, roles, channels, threads, emojis, stickers, invites, people joining and leaving voice channels, and the server's own settings. Each kind of post goes to the channel you choose for it, so you can have a #member-logs, a #voice-logs and so on.

It needs the modlog module and the Server log feature (Settings → Features), which are both on by default. Nothing is posted until you choose a channel, because some kinds (voice especially) are busy.

What's logged

Group Kind Key Posted when
Members Joined with invite inviteused Someone joins: the invite they used, who made it, its channel and how many times it's been used. See Which invite someone joined with
Members Member given a role roleadd Someone is given one or more roles
Members Member's role removed roleremove Someone has one or more roles taken away
Roles Role created rolecreate A role is made, with its colour and permissions
Roles Role changed roleupdate A role's name, colour, permissions (given and taken away), "shown separately", "mentionable" or icon changes
Roles Role deleted roledelete A role is deleted
Channels Channel created channelcreate A channel or category is made
Channels Channel changed channelupdate A channel's name, topic, category, age restriction, bitrate, user limit or permissions change. Slowmode has a post of its own, below. Permission changes list, for each role or member, what's newly allowed, denied and back to default.
Channels Channel deleted channeldelete A channel or category is deleted
Channels Threads threads A thread or forum post is started, renamed, locked or unlocked, or deleted
Emojis and stickers Emoji added, Emoji renamed, Emoji deleted emojicreate, emojiupdate, emojidelete An emoji is added, renamed or deleted
Emojis and stickers Stickers stickers A sticker is added, changed or deleted
Voice Voice channel joined, left, moved voicejoin, voiceleave, voicemove Someone joins, leaves or switches voice or stage channel
Server Invites invites An invite is made (with its code, channel, who made it, uses and expiry), or deleted
Server Server settings server The server's name, icon, banner, description, owner, verification level, explicit image filter, default notifications, 2FA requirement, AFK channel and timeout, system, rules and community-updates channels, vanity URL or language changes

These are posted elsewhere already:

Dyno-style event Where it is
Message deleted, edited, image deleted, bulk delete The message log, in its own locked channel
Member joined and left First appearances and Joins and leaves; the invite they used is Joined with invite, above
Nickname changed Name changes (for people on record)
Member banned, unbanned, timed out; moderator commands Cases: bans, unbans and timeouts made with Discord's own menus become cases too, with the Record bans made by hand feature
Slowmode turned on, changed or off Slowmode (under Channels, posted in the mod-log unless you choose otherwise, and needing only the mod-log feature): with the channel, the old and new slowmode, and who set it. For /slowmode, that's the moderator who used it, not the bot

Some changes aren't posted on purpose, because Discord makes many at once:

  • Moving a role or channel up or down the list (Discord moves every role or channel in between too).
  • Threads being archived, which Discord does by itself when a thread goes quiet.
  • Muting, deafening and streaming in voice.

Who made the change

Discord doesn't say who made a change, but its audit log does. So the bot reads the audit log a moment after each change, and the post has a By field (and Reason, if one was given):

  • a person or bot, when there's an entry for it from the last 30 seconds;
  • Unknown, when there isn't, or the bot can't read the audit log. Give it View Audit Log; Network status lists it as missing while the server log is on.

Voice posts and new threads don't have By: joining voice and starting a thread is done by the person themselves. When an invite is "deleted" with no audit-log entry, it ran out or was used up, and the post says so.

Which invite someone joined with

Discord doesn't say which invite someone used, so, like other bots, the bot keeps count of each server's invites and how many times each has been used. When someone joins it counts again, and the invite that went up is the one they used. This needs the bot to have Manage Server. It's in the invite link; servers that added the bot with an older link may not have it, and Network status lists it as missing where Joined with invite is posted.

It's a good guess, not a certainty:

  • Several invites listed: two people joined at almost the same moment, so more than one invite went up before the bot could count. The post lists them all.
  • An invite that's gone: an invite on its last use is deleted by Discord as it's used, so when one that was one use from its limit disappears, the bot counts it as the one used.
  • The vanity URL: if the server has one and its count went up, the post says so.
  • Can't tell: nothing went up (they came from Server Discovery, a server template or an app), the bot can't read invites (no Manage Server), or it had only just started counting: right after it connects, after Joined with invite is turned on, or after a join it didn't check. The next join is worked out as normal.

Bots added to the server aren't posted: someone adds them, without an invite.

Setting it up

  1. Give the bot View Audit Log in the server. For invites, it also needs Manage Channels (Discord only tells bots that can manage the channel about invites), and for Joined with invite, Manage Server.
  2. Create the channels you want, such as #member-logs, #role-logs, #voice-logs and #server-logs.
  3. In the panel, go to Settings → Where things are posted. For each kind, open Per server and choose the channel in each server. You can also choose Mod-log for the whole network, which sends that kind to every server's mod-log channel.
  4. Check the server is green on Network status: a channel the bot can't post in turns it red.

The API sets the same choices with PUT /api/v1/network/posts/{kind}, using the keys above (API).

How the posts look

Each kind of post (and each of created, changed and deleted) can be restyled in Settings → Log posts: its colour, title, description and footer, and which fields show. See Log-post layouts. The default colours are green for something added, blue for a change and red for something removed; themes can change them with the log_created, log_changed, log_deleted and voice colours, and the emojis with role, channel, thread, emoji, sticker, voice, invite and server.

Privacy

The server log isn't kept by the bot: it's only posted in Discord. It shows when people join and leave voice channels, so keep #voice-logs to staff, and say in your rules that voice activity is logged.

Are you sure?