Jump to content
  • 0
Blyzz

Linux Server API - IS there one?

Question

Hi there,

 

I've set up a dedicated Linux Server online. But would like to be able to access it to draw stats from it. to post to my discord.

 

1: How many people are currntly connected to the server.

2: Did someone die in the last 5 minutes? who? how?

3: How many zombies have been killed in the last x minutes.

etc

 

Is there an API that can be accessed? IF so, please let me know how! IF not, Is there a plan to add it? If not, WHY NOT!

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 1

1. Use the server command "players" to see online players
2. Check the game logs in the Zomboid / Logs folder for any deaths or other actions
3. Zombie deaths are not specifically logged.

Share this post


Link to post
Share on other sites

  • 0
On 1/11/2022 at 3:09 AM, Beard said:

1. Use the server command "players" to see online players
2. Check the game logs in the Zomboid / Logs folder for any deaths or other actions
3. Zombie deaths are not specifically logged.

 

Thanks for this info, I didn't know that it was there and has been very enlightening!

But I'm finding these logs VERY lacking.

 

I've tried a few different ways of pulling the info from the logs, primarily by grepping

    ~/Zomboid/Logs/*_user.txt

with:

    "allowed to join" and
    "allowed to join" (for joining)

also with: 

    "removed connection" and
    "disconnected player" (for leaving)

 

I've also tried grepping:

    ~/Zomboid/server-console.txt 

with: 

    "Connected new client" (for joining)

and

    "Disconnected player" (for leaving)

 

HOWEVER, I've run into problems with all of them as they often miss BOTH people joining and people leaving. I've been testing it on myself.

I'll join, and play the game for a good 20 minutes or sometimes even more, then quit out (tried both quitting to menu and quitting to desktop).

 

I haven't really tested the deaths as yet as I'm trying to get the joining and leaving working before I move on to other Info Updates.

 

 

As an example; I've been logging in and out of the server all day. It is now 18:38 and here's a screenshot I just made of the last time the files were touched on the server
image.png.99b455259cf0dac2c3437a3527ef0ca8.png

As you can see the last time the user.txt file was touched (edited) was at 11:55 THIS MORNING!

 

This effectively makes thes log files unusuable for my needs.

 

Is there a way to FORCE the server to update it in real time?

 

Edited by Blyzz
Additional Info

Share this post


Link to post
Share on other sites

  • 0

The logs can get filled up (10mb) and then they create a separate file based on the time they were created. There are also logs created on every server restart. The only real-time log would be the "server-console.txt" file which should cover almost all the logs.

Share this post


Link to post
Share on other sites

  • 0

Ok, I think I found the most robust way of getting real-time info, and it's in the actual live server info provided when running the Server itself.

 

I use crontab to autom  atically run the server after reboot and I use a line very similar to this

 

@reboot bash /home/pzuser/pzserver/start-server.sh  -servername <servername> > /var/log/pz.log 2> /var/log/pz.err
 

THEN all I need to do is access the /var/log/pz.log to get what I need.

 

Using basic logrotate will prevent the file from getting out of control, but the actaul log file will always be pz.log instead of a changing name, which also makes it cleaner in the monitoiring script.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...