1. Go to this page and download the library: Download nazonohito51/log-analyzer 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/ */
nazonohito51 / log-analyzer example snippets
use LogAnalyzer\CollectionBuilder;
$collection = (new CollectionBuilder())->addApacheLog('path/to/apache1.log')->addApacheLog('path/to/apache2.log')->build();
$collection->dimension('request')->addColumn('host')->addColumn('HeaderUserAgent')->table()->display();
/*
+---------------------------------+-------+-------------------------------+-----------------------------------------------------------------------------------------------------------------+
| request | Count | host | HeaderUserAgent |
+---------------------------------+-------+-------------------------------+-----------------------------------------------------------------------------------------------------------------+
| GET /users/1/articles HTTP/1.0 | 1 | 133.130.35.34 | Mozilla/5.0 (Windows CE) AppleWebKit/5350 (KHTML, like Gecko) Chrome/13.0.888.0 Safari/5350 |
| POST /users/1/articles HTTP/1.0 | 1 | 133.130.35.34 | Mozilla/5.0 (Windows CE) AppleWebKit/5350 (KHTML, like Gecko) Chrome/13.0.888.0 Safari/5350 |
| GET / HTTP/1.1 | 3 | [23.96.184.214, 93.158.152.5] | Mozilla/5.0 (Windows CE) AppleWebKit/5350 (KHTML, like Gecko) Chrome/13.0.888.0 Safari/5350 |
| GET /robots.txt HTTP/1.1 | 1 | 93.158.152.5 | Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots) |
| POST /users/2/profile HTTP/1.0 | 1 | 133.130.35.34 | Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) AppleWebKit/5312 (KHTML, like Gecko) Chrome/14.0.894.0 Safari/5312 |
| POST /users/3/articles HTTP/1.0 | 1 | 133.130.35.35 | Mozilla/5.0 (X11; Linuxi686; rv:7.0) Gecko/20101231 Firefox/3.6 |
| GET /login HTTP/1.1 | 1 | 66.249.79.82 | Mozilla/5.0 (compatible; MSIE 7.0; Windows 98; Win 9x 4.90; Trident/3.0) |
+---------------------------------+-------+-------------------------------+-----------------------------------------------------------------------------------------------------------------+
*/