PHP code example of tsuijie / php-grok
1. Go to this page and download the library: Download tsuijie/php-grok 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/ */
tsuijie / php-grok example snippets
composer
use Tsuijie\PHPGrok\Grok;
$g = new Grok;
$g->addPatternsFromPath();
$array = $g->match('%{COMMONAPACHELOG}', '0.0.0.0 - - [17/May/2015:10:05:03 +0000] "GET /presentations/logstash-monitorama-2013/images/kibana-search.png HTTP/1.1" 200 203023 "http://semicomplete.com/presentations/logstash-monitorama-2013/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"');
print_r($array);