OTTD server logfile

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
Grolsch
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 08 May 2004 07:48
Location: Alkmaar, The Netherlands

OTTD server logfile

Post by Grolsch »

Is it possible to let OpenTTD create a log file with information who joined the server at what time? I can't always be online, but sometimes I want to know who was online and messed up a multiplayer game so I can ban his/her IP. I know there is the autopilot, but I couldn't find if this was possible. If this is impossible at this moment, is it difficult to create? Perhaps some server-admins with programming skills can make some patch that eventually gets in the trunk.

Example of logfile:

Code: Select all

24-07-2007 15:30 
Join: Playername 
Client-id: #523
IP: 123.456.789.012

24-07-2007 15:32
Leave: Player2
Client-id: #12
IP: 987.654.43.21

24-07-2007 15:34
Leave: Playername
Client-id: #523
IP: 123.456.789.012
Beer equals power
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: OTTD server logfile

Post by DaleStan »

Autopilot already saves the game at every join, so it shouldn't be too hard to extend it to write a logfile for joins. Quits may be more difficult, though.

Look around to see if the chat is loggable; that may also give you the desired information.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Grolsch
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 08 May 2004 07:48
Location: Alkmaar, The Netherlands

Re: OTTD server logfile

Post by Grolsch »

DaleStan wrote:Autopilot already saves the game at every join, so it shouldn't be too hard to extend it to write a logfile for joins. Quits may be more difficult, though.

Look around to see if the chat is loggable; that may also give you the desired information.
A save at every join? If you have a busy server and a 1024x1024 map, the OpenTTD folder would be 100's of MB's after a few days! Not really an option IMHO...
Beer equals power
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: OTTD server logfile

Post by XeryusTC »

Autopilot has a log function, just give it mysql access and it will start logging, or well, it should start logging.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: OTTD server logfile

Post by DaleStan »

Grolsch wrote:A save at every join? If you have a busy server and a 1024x1024 map, the OpenTTD folder would be 100's of MB's after a few days! Not really an option IMHO...
It might be the same file every time. The point is so that you can roll back to just before a griefer actually got around to causing any grief, so anything older than a few hours probably isn't very useful any more.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Grolsch
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 08 May 2004 07:48
Location: Alkmaar, The Netherlands

Re: OTTD server logfile

Post by Grolsch »

XeryusTC wrote:Autopilot has a log function, just give it mysql access and it will start logging, or well, it should start logging.
Too bad my mysql-skills are bad, to put it mildly ;) However I do already have a webserver with sql running which logs visitors of my website. This was made by a friend who does have some programming skills. Is there a way to connect these two? Or some kind of manual or helpfile that could help me on the way?
Beer equals power
t2t2
Engineer
Engineer
Posts: 46
Joined: 08 Jul 2004 13:22
Location: .ee

Re: OTTD server logfile

Post by t2t2 »

Umm isn't this kinda it?
An example script:

Code: Select all

echo "Starting server"
script openttd.log
net_frame_freq = 1
set name "My Server"
If we then save the above script as on_dedicated.scr, it will be run whenever a dedicated server is started, and do the following:

* It will Print "Starting Server" in the console window
* It will begin logging the non-debuging output from the console window to openttd.log
* net_frame_freq will be set to 1
* The server name will be set to "My Server"
Kanibal wrote::twisted: :twisted: Why is illegal stuff always fun :twisted: :twisted:
Refresh page and my avatar colors will change!
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: OTTD server logfile

Post by Bilbo »

BTW why the command to log console output to file is called "script". It seems to be quite unintuitive. I expected to have it name like "log" or "logfile" or "consolelog" or something like that ... not "script" ...
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
Grolsch
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 08 May 2004 07:48
Location: Alkmaar, The Netherlands

Re: OTTD server logfile

Post by Grolsch »

t2t2 wrote:Umm isn't this kinda it?
(cut)
Well, I tried that just now, but the file stays 0kB (no text in it).

However your link is interesting. I'm trying some scripting now, but how do I send a message to the player currently connecting to my server? If I use the "say" command, everybody sees it. If I use "say_client" it obviously needs a client-id. Anybody?

Yes, it is offtopic... But my other question still stands ;)
Beer equals power
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 27 guests