piedweb/logs-analyzer

Can parse, filter and export to CSV via PHP or CLI your APACHE/Nginx/Microsoft/WhatYouWant logs.

v0.0.2 2021-01-20 15:33 UTC

This package is auto-updated.

Last update: 2021-12-20 18:13:48 UTC


README

Open Source Package

Logs Analyzer

Latest Version Software License GitHub Tests Action Status Quality Score Code Coverage Type Coverage Total Downloads

This package can parse, filter and export to CSV via PHP or CLI your APACHE/Nginx/Microsoft/WhatYouWant logs.

FR: https://piedweb.com/seo/logs

Install

Via Packagist

$ composer require piedweb/logs-analyzer

Usage

Tu use it directly in php, see bin/analyzer example.

Else, you can use the command tools to filter and export to CSV your log files. Get the last args list via --help :

bin/analyzer --help

About --format

Default parser work with Apache Access Logs :

^(?P<host>[a-zA-Z0-9\-\._:]+) (?P<logname>(?:-|[\w-]+)) (?P<user>(?:-|[\w\-\.]+)) \[(?P<time>\d{2}/(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/\d{4}:\d{2}:\d{2}:\d{2} (?:-|\+)\d{4})\] "(?P<request>(?:(?:[A-Z]+) .+? HTTP/(1\.0|1\.1|2\.0))|-|)" (?P<status>\d{3}|-) (?P<responseBytes>(\d+|-)) "(?P<HeaderReferer>.*?)" "(?P<HeaderUserAgent>.*?)"$

You can change the regex directly via the CLI or by creating a new Class managing your special format. Your new class must extends \PiedWeb\LogsAnalyzer\LogLine.

About --resume

This arg permits to have only unique request (requestMethod + url + status) keeping only the first date and time and counting the number of hit

Testing

$ composer test

Contributing

Please see contributing

Credits

License

The MIT License (MIT). Please see License File for more information.

Latest Version Software License Build Status Quality Score Code Coverage Total Downloads