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.
Available in AxoSyslog version 3.33 and later.
Declaration:
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.
To use this destination, the scl.conf
file must be included in your AxoSyslog configuration:
@include "scl.conf"
The discord()
driver is actually a reusable configuration snippet configured to send log messages using the http()
driver. For details on using or writing such configuration snippets, see Reusing configuration blocks. You can find the source of this configuration snippet on GitHub.
Prerequisites
To send messages to Discord, you must setup webhooks. For details, see: Discord: Intro to Webhooks.
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
);
รณ}