Log Files

From Hostek.com Wiki
Jump to: navigation, search

How Long Are Log Files Kept?

We will always leave at least the last 30 days of WWW logs in your "W3SVCxxx" folder. If you wish to keep log files from older than 30 days, you'll need to download the log files to your local machine. Log files older than 30 days may be deleted from the server to conserve disk space and help keep the server running at an optimal level.

Getting IP addresses From Site Log Files

If you need to get the lines out of the logs for a certain IP you can use the PHP code below:

  • NOTE: You'll need to change the $ip and $file variables to match your needs.
header('Content-type: text/plain');
$ip = '';
$file = 'D:\home\example.com\logs\W3SVC123\ex090430.log';

if ($fh = fopen($file, 'r')) {
while ($line = fgets($fh)) {
if (strpos($line, $ip) !== FALSE) {
echo $line;
} else {
die("Can't open $file for reading.\n");