Manage your server logs directly from a Discord channel
Pre-requisites • Usage • License • Contributing
You must have curl
installed in order to work. Use the package manager on your Linux distro to install it.
To use this script, follow the steps below:
-
Clone this repository to your local machine:
git clone https://github.com/nanometer5088/logfile-to-discord.git
The script requires some information to be edited before running:
-
Edit the
log_broadcast.sh
script:- Set the
LOG_FILE
variable to the path of your log file. - Replace
ENTER YOUR WEBHOOK LINK HERE
with your Discord webhook URL in theDISCORD_WEBHOOK_URL
variable. - Replace
"SERVICE ON LOG"
in the script to match the software you want to broadcast. This way, not every line will be sent to discord, only new lines from a specific software or service. - Replace
"FILTER"
with the message prior to the actual log message. This results in clean messages. - Replace
"DISCORD USER ID"
with your User ID. You will be tagged on Discord when the message is sent.
- Set the
-
Move the
log_broadcast.sh
script to a suitable location, e.g.,/opt/log_broadcast.sh
. -
Edit the
log_broadcast.service
file:- Set the
ExecStart
path to the location of thelog_broadcast.sh
script. - (optional) Change the user the script run as by replacing
root
with the desired user.
- Set the
-
Move the
log_broadcast.service
file to the systemd services directory:sudo mv log_broadcast.service /etc/systemd/system/
-
Reload the systemd daemon:
sudo systemctl daemon-reload
-
Start the log broadcast service:
sudo systemctl start log_broadcast.service
You can also enable the service to start automatically on boot:
sudo systemctl enable log_broadcast.service
-
Check the status of the service:
sudo systemctl status log_broadcast.service
If everything is set up correctly, you should see the service running without any errors.
This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3). This license requires that any modifications to the code must also be made available under the same license, even when the software is run as a service (e.g., over a network). See the LICENSE file for details.
If you find any issues or have suggestions for improvements, please open an issue or submit a pull request. Your contributions are greatly appreciated.