IPv4 Fremnet Logo
TOOLS, TINKERINGS & CODE

Good code yeh?

Source Log Proxy · Nov 24, 21:34 by Shannon Wynter

Yesterday I got an enquiry from Sam Cleaver regarding my Source RCON Class

He wanted to know how he could get the logs from the server using my class. Unfortunatly the answer is that you can not.

I have however written a little perl proxy and an example php script that’ll “Slow Load”/“Ajax” the log to your browser.

Go ahead and download the script

File: logproxy.pl [5.51 kB]
Download: 238

You’re going to want to place it on a server somewhere (preferably the same one as your apache/php is on, not nesicarily your game server)

You should edit the file configure the %servers_list variable as I’m sure the default list isn’t going to help you – Try to avoid “: “ combinations as it makes it harder to process in javascript later

<pre> my %servers_list = ( "202.168.47.18:27015" => "Fremans test server", "10.10.10.10:27015" => "Another server" ); </pre>

Once you’ve done your edits you should chmod +x logproxy.pl to make it executable.

Then go ahead and run it (Note: You should not run this script as root, it has no need to do anything special)

screen -A -m -d -S logproxy ./logproxy

Then you’re going to want to put this in a directory accessable from your webserver.

File: srclog.tar.bz2 [17.86 kB]
Download: 159

Note: This is a minimalistic implementation, I’ve knocked it up as an example – I might do more with it later.

You shouldn’t need to do much with it to get it working.

Now you have to go to your cs:s server (via RCON) and execute the following two commands

  1. log on
  2. logaddress_add [theaddressofthelogproxymachine]:9180

Provided you have opened port 9180 in your firewall you should see output on your srclog page.

Comments

Commenting is closed for this article.

---== Copyright Shannon Wynter - All rights reserved - All wrongs avenged ==---