1

I'm looking to actively build a log file from ongoing tf2 games. Using logaddress_add rcon command, I can get a server to send log entries as they happen, but I'm a bit over my head in getting condenser to keep an active port open and retrieve the log entries as they arrive. Is something like this feasible?

 $server = new SourceServer($ip);
 $File = "MyServer.log";
 $fh = fopen($File, 'w');
 while(!$stop)
 {
    set_time_limit(0);
    $reply = $server->Socket->getReply(); //????
    fwrite($fh, $reply);
    if(parseForEnd($reply) == MATCHEND) {
       $stop = True;
    }
 }
 fclose($fh);

I was thinking of extending GameServer or SourceServer but I'm not sure if the ports stay open as long as I'd need or if I'd need to dive deeper. Any help would be great.

Koraktor
  • 41,357
  • 10
  • 69
  • 99
  • Try and test first. Let us know if it works or not. If it does not work, describe what is not working, give error messages if possible. (your loop generally suggest it should work) – hakre Dec 27 '12 at 23:34
  • I have tried the above code and it fails to get any reply. It executes to ' $reply = $server->Socket->getReply(); ' and then stops abruptly without any error message. Suggesting to me that it hangs? I've tried putting it in a try statement and it doesn't throw anything. So sadly I have very little to give in terms of error checking. – user1933081 Dec 28 '12 at 00:35
  • Enable PHP error logging. Set the reporting level to the highest setting (including all errors, warnings and notices). You find the settings in the file called `php.ini`. That file is self-documented. After you've set it up, follow the error log. – hakre Dec 28 '12 at 00:36
  • @hakre Thanks, I just checked it again and I have it at 'error_reporting = E_ALL' Still no error or warning. I've resulted to throwing echo statements in the loop to see if it iterates, but it just hangs at the same line of code indicating to me that something is pretty wrong. I feel I'm missing something critical with my understanding of the library. – user1933081 Dec 28 '12 at 00:49
  • Depending on PHP version `E_ALL` (despite the name) must not show the whole picture (yes, I know it's lame, was corrected in PHP 5.4 IIRC). Also it's crucial you *log* errors. And check if the code is intended for CLI use or not. Mind the timeout settings of PHP as well. – hakre Dec 28 '12 at 00:50

2 Answers2

0

Steam Condenser doesn't currently support gathering logs.

There's no way to open a listening UDP socket for incoming log packets. I already had the idea to add this feature in an upcoming version, but there isn't any code yet.

Feel free to contribute if you feel comfortable with HLDS'/SrcDS remote logging.

Koraktor
  • 41,357
  • 10
  • 69
  • 99
  • For anyone who's interested in this feature, please take a look at the following issue and feel free to comment: https://github.com/koraktor/steam-condenser/issues/181 – Koraktor Dec 30 '12 at 14:17
0

You should have a look to Steam HLDS Log Parser which is in Ruby, get logs from server, parses, and returns usable data.

tvial
  • 612
  • 5
  • 9