nebubit / aparse
A command line tool for PHP developers to analyze Apache log file.
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Type:tool
Requires
- php: >=5.5
- psy/psysh: ~0.8
Requires (Dev)
- phpunit/phpunit: ~4.8
- squizlabs/php_codesniffer: 3.*
This package is not auto-updated.
Last update: 2024-04-28 00:37:55 UTC
README
About AParse
A command line tool for PHP developers to analyze Apache log file. You may ask we already have sed, awk, and the others. Why did you still make this tool? Because the syntax of those tools is too unreadable for who are not familiar with pip commands like system admin. A lot of time will be spent on reading the reference to achieve a very simple aim, such as counting the status code.
Requirements
- PHP version 5.5 or greater
Installation
composer global require "nebubit/aparse=*"
Make sure you have the composer bin dir in your PATH. The default value is ~/.composer/vendor/bin/, but you can check the value that you need to use by running composer global config bin-dir --absolute. Then appending this path to your terminal environment file by running following command. Don't forget to restart your terminal.
For bash
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
For Z shell
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc
Steps for Query
- Select a file.
use access-file-name.log
- Query
$db->select('c1', 'c2')->get(3)
Examples
Using GROUP BY and COUNT to get an aggregation result.
$db->select('*')->count('c3')->group('c3')->get(3)
Grouping result with WHERE conditions.
$db->select('c1', 'c2')->count('c3')->where(['c3'=>'400'])->group('c3')->get(3)
Terms
The "c" in select fields stands for column.
Contributing
Thank you for considering contributing to the AParse! Please read the following guide lines before you pull request.
- Follow the PSR-2 coding standard and the PSR-4 autoloading standard.
- Document any change in behavior.
- Add test cases and check if tests pass.