discord: Send alerts and notifications to Discord
The discord() destination driver sends messages to Discord using Discord Webhook. For the list of available optional parameters, see Discord destination options.
Prerequisites
-
AxoSyslog version 3.33 or later.
-
Install the
axosyslog-sclpackage on Debian/Ubuntu. On RHEL and compatible distributions, the SCL files are part of theaxosyslogbase package.Your configuration must also contain
@include "scl.conf", which the default configuration file already does. If the SCL files are missing, AxoSyslog fails to start with anunexpected LL_IDENTIFIERerror.Terminal window @include "scl.conf"The
discord()driver is a reusable configuration snippet (SCL). For details on using or writing such configuration snippets, see Reusing configuration blocks. You can find its source in scl/discord/discord.conf on GitHub. -
This feature requires a separate module. Install the
axosyslog-mod-httppackage on Debian/Ubuntu, or theaxosyslog-httppackage on RHEL and compatible distributions. If the module isn’t installed, AxoSyslog fails to start with anunexpected LL_IDENTIFIERerror. -
To send messages to Discord, you must setup webhooks. For details, see: Discord: Intro to Webhooks.
Declaration:
@include "scl.conf"
# ...
destination {
discord(url("https://discord.com/api/webhooks/x/y"));
};By default the message sending is throttled to 5 message/sec, see Discord: Rate Limits. To change this, use the throttle() option.
Example: Using the discord() driver
The following example sends messages with custom avatar, and text-to-speech enabled.
@include "scl.conf"
destination d_discord {
discord(
url("https://discord.com/api/webhooks/x/y")
avatar-url("https://example.domain/any_image.png")
username("$HOST-bot") # Custom bot name, accepts macros
tts(true) # Text-to-Speech message
template("${MSG:-[empty message]}") # Message to send, can't be empty
);
}