Network Administrator Knowledgebase

Nov 23 2007   9:35AM GMT

Content on log files via browser

Michael Khanin Michael Khanin Profile: Michael Khanin

I’ve a client that runs special program on about 100 servers. This program writes a log on central server every 3 minutes. So, when I checked main server, I found a directory Logs (C:\Logs). Log’s directory contains many log files (each log for each server).  On this server installed and runs a web server, Apache ;). So, I’d like to show a small AppsRuns.php file, which stored on web server. If we go to the http://server1/AppsRuns.php we will see a content of each log file on one web page. This web page refreshing every 10 sec. Here is a content of AppsRuns.php file:

    $refresh_time = 10; // seconds
    $path = "C:\LOGS";

    header("Content-Type: text/plain");
    header("Refresh: $refresh_time");

    if($handle = opendir($path)) {
    while (false !== ($file = readdir($handle))) {
        $pi = pathinfo($path . '/' . $file);
        if($pi['extension'] === 'txt') {
        include($path . '/' . $file);

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: