creating an additional custom log file

Fark_Maniac

2[H]4U
Joined
Feb 21, 2002
Messages
2,438
I'm running apache 2.2.4 w/ php 5.2

My end result is to log the IPs of visitors into either a flat file or a mysql database. Only problem is that I'm behind a router. So in PHP, the "remote_server" or host or whaterver you are really supposed to use, always ends up with the internal IP of my router....however, apache knows the visitors IP as I can look in my access log file. Now I don't want to stop logging what is already in the log file, I would like to figure out how to create a logfile something like "clientip.log".

I've tried looking in the Apache documentation, and it only discusses how to alter your log file to log what you want...not how to create a completely new logfile, keeping the default log files in tact.

Are there any guides out there? Hope I wasn't completely confusing ;)
 
this is WAAAAAAAAAAAY overkill, but it's the only method i'm aware of. the apache mod_perl module would allow you to automatically call a perl handler routine during each transaction. the handler could easily be written to access various information from the request and log it via mysql, plain txt, etc. i've used it for some pretty extensive logging with mysql.

but i mean, couldnt you do something similar with php? just embed a function in every page that does the same? or something like that? never used php personally
 
PHP does have the functions, but like I said, it grabs the router's internal IP instead of the client's...but apache logs the client's IP correctly.
 
Back
Top