PHP code example of theodorejb / iis-log-parser

1. Go to this page and download the library: Download theodorejb/iis-log-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

theodorejb / iis-log-parser example snippets


use theodorejb\IISLogParser\IISLogFile;

$directory = new \FilesystemIterator('C:/inetpub/logs/LogFiles/W3SVC1');

while ($directory->valid()) {
    $current = $directory->current();
    echo "Processing {$current->getFilename()}\n";
    
    $entries = IISLogFile::getEntries($current->openFile());

    foreach ($entries as $entry) {
        echo "Request to {$entry->uri} occurred on {$entry->date->format(DATE_ATOM)}\n";
    }

    echo "\n";
    $directory->next();
}