The International Simutrans Forum

 

Author Topic: Change to logging to show IP address/player name for all statements  (Read 1371 times)

0 Members and 1 Guest are viewing this topic.

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
I'd hope that this would be a fairly minor change, but it'd really help with administering a server. I tend to run my Simutrans servers on debug level 2 since that gives enough information without overwhelming the logging.

Whenever any player performs an action we get logging like this:

Code: [Select]
Warning: nwc_tool_t::rdwr:#011rdwr id=6 client=3 plnr=9 pos=157,239,2 wkzid=8218 defpar=b,403,57,-2,162 init=1 exec=1 flags=0
The wkzid value seems to be a unique ID for each possible action, e.g. 8224 is a chat message. plnr is the player number, client is the entry in the connected clients list etc.

It'd be much more useful if the logging also included the name of the player as it is displayed in-game alongside the IP address of the connected client. E.g.:

Code: [Select]
Warning: nwc_tool_t::rdwr:#011rdwr id=6 client=3 ipaddr=12.34.56.78 plnr=9 plname=H-Trans pos=157,239,2 wkzid=8218 defpar=b,403,57,-2,162 init=1 exec=1 flags=0
If this were implemented I could easily write a script that parses the log file to track the names of players in game (by referencing the plnr verses plname) and the IP addresses of clients connecting in. These would allow for banning troublesome players using a firewall to prevent connections.

Obviously more extensive administrative functions need to be added but as a quick measure to implement this would make life a lot easier :)