Using Python
Report Bug
·
Request Feature
This project's purpose is to increase the experience of playing Valheim in a
dedicated server with some friends, by notifying in Discord some Valheim Server
log events, such as ServerOn, ServerOff, PlayerJoined, PlayerDead, etc.
Essentially, it continuously reads the server logs and reacts to some events that match certain patterns. Whenever a match appear, it generates a template for sending alerts to a Discord server. It has the capability to adapt to rotating log files, too
You'll need to install the following in order to be able to run the application
And to configure some envvars in your Valheim Server
VALHEIM_LOG_PATH # Path to current server console log
DISCORD_WEBHOOK_URL # Discord Webhook URLIt depends on how you configured your Valheim Server. For example, for LinuxGSM
installations, it's located in /home/<your-username>/log/console/vhserver-console.log
by default
It's really simple! Please refer to their Official Documentation for better guidelines
To get a local copy up and running follow these simple steps.
First, we'll get the code
In your Valheim Server
- Clone the repo
git clone https://github.com/jaumebecks/valheim-server-notifier.git- Go into project root
cd valheim-server-notifier- Update .env file
cp .env.dist .env- Open
.envfile and fill it with proper values
We're going to create a systemctl service that will be running always in our
server. To do so, first we need to create a file under /etc/systemd/system/
folder
- Create a file with your preffered name
sudo touch /etc/systemd/system/valheim-odin.service- Edit the file with your preffered editor and put
[Unit]
Description=Valheim Server Notifier
Wants=network-online.target
After=syslog.target network.target nss-lookup.target network-online.target
[Service]
Type=simple
Restart=on-failure
RestartSec=5
StartLimitInterval=1s
User=<your-username>
Group=<your-groupname>
ExecStart=/usr/bin/python3 /home/<your-username>/valheim-server-notifier/odin/main.py
EnvironmentFile=/home/<your-username>/valheim-server-notifier/.env
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s INT $MAINPID
LimitNOFILE=100000
[Install]
WantedBy=multi-user.targetRemember to update the variables with proper ones for your own setup
- Enable the service in your server
systemctl daemon-reload
systemctl start valheim-odin.service
systemctl enable valheim-odin.serviceAnd that's it! Now the python script will be reading from Valheim server logs, waiting to post any event into Discord :D
To run the script in local
VALHEIM_LOG_PATH=<fill-with-your-log-file> DISCORD_WEBHOOK_URL=<fill-with-your-webhook-url> python3 odin/main.pyRemember to add some envvars first
To check the logs for systemctl service
journalctl -u valheim-odin.service| Server On | ![]() |
| Server Off | ![]() |
| Player Joined | ![]() |
| Player Died | ![]() |
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Jaume Jiménez - @jaumebecks
Project Link: https://github.com/jaumebecks/valheim-server-notifier
- @joselgomezs As an inspiration for the solution
- Reddit user
somekindofsorcery



