Nginx log parser
Project description
nginx\_parser
=============
It works on python2.7 and python 3.\*
-------------------------------------
Caution in this version of the log format is changed!
Added $upstream\_response\_time.
All reports are based on this value.
Also added the report is based on the difference between
:math:`request_time and `\ upstream\_response\_time.
Installation:
::
pip install nginxparser
Using log format:
::
log_format myformat '$remote_addr - [$time_local] "$host" "$request" '
'$status ($bytes_sent) "$http_referer" '
'"$uri $args" [$request_time] [$upstream_response_time]';
usage:
::
usage: nginxparser [-h] --logfile LOGFILE [--outfile OUTFILE]
[--period PERIOD PERIOD]
[--exclude [EXCLUDE [EXCLUDE ...]]] [--time] [--count]
[--median] [--status [STATUS [STATUS ...]]] [--remote]
[--difference DIFFERENCE] [--limit LIMIT] [--debug]
optional arguments:
::
-h, --help show this help message and exit
--logfile LOGFILE, -l LOGFILE
Log file for analysis
--outfile OUTFILE, -o OUTFILE
File to save the output reports
--period PERIOD PERIOD, -p PERIOD PERIOD
Specify the period for which you need to make reports.
Using format: Y.m.d_H:M:S. Example: --period
2015.10.19_00:00:00 2015.10.20_00:00:00
--exclude [EXCLUDE [EXCLUDE ...]], -e [EXCLUDE [EXCLUDE ...]]
The part of URL that are excluded from reporting
--time, -t Print the report based on the total call time
--count, -c Print the report based on the total number of queries
--median, -m Print the report based on a median duration of calls
--remote, -r Print the report based on the number of calls from
remote hosts
--difference DIFFERENCE, -d DIFFERENCE
Print the report is based on the difference between
$request_time and $upstream_response_time. It
specifies the minimum difference, in seconds, for the
registration of the request. Example -d 0.5
--status [STATUS [STATUS ...]], -s [STATUS [STATUS ...]]
Print the report, based on the request status
--limit LIMIT, -L LIMIT
Limit the output reports. Default 100.
--debug, -D Displays the count of unparsed lines and the unparsed
line numbers
examples:
::
nginxparser -l /path/to/access_nginx.log -t -e /static /exclude
nginxparser -l /path/to/access_nginx.log -s 500 499 -o /path/to/outfile.txt
nginxparser -l ../nginx_access.log -o ../test_all.txt -e /static /pull -tcmrS -s 499 500 -p 2015.10.06_00:00:00 2015.10.07_00:00:00
=============
It works on python2.7 and python 3.\*
-------------------------------------
Caution in this version of the log format is changed!
Added $upstream\_response\_time.
All reports are based on this value.
Also added the report is based on the difference between
:math:`request_time and `\ upstream\_response\_time.
Installation:
::
pip install nginxparser
Using log format:
::
log_format myformat '$remote_addr - [$time_local] "$host" "$request" '
'$status ($bytes_sent) "$http_referer" '
'"$uri $args" [$request_time] [$upstream_response_time]';
usage:
::
usage: nginxparser [-h] --logfile LOGFILE [--outfile OUTFILE]
[--period PERIOD PERIOD]
[--exclude [EXCLUDE [EXCLUDE ...]]] [--time] [--count]
[--median] [--status [STATUS [STATUS ...]]] [--remote]
[--difference DIFFERENCE] [--limit LIMIT] [--debug]
optional arguments:
::
-h, --help show this help message and exit
--logfile LOGFILE, -l LOGFILE
Log file for analysis
--outfile OUTFILE, -o OUTFILE
File to save the output reports
--period PERIOD PERIOD, -p PERIOD PERIOD
Specify the period for which you need to make reports.
Using format: Y.m.d_H:M:S. Example: --period
2015.10.19_00:00:00 2015.10.20_00:00:00
--exclude [EXCLUDE [EXCLUDE ...]], -e [EXCLUDE [EXCLUDE ...]]
The part of URL that are excluded from reporting
--time, -t Print the report based on the total call time
--count, -c Print the report based on the total number of queries
--median, -m Print the report based on a median duration of calls
--remote, -r Print the report based on the number of calls from
remote hosts
--difference DIFFERENCE, -d DIFFERENCE
Print the report is based on the difference between
$request_time and $upstream_response_time. It
specifies the minimum difference, in seconds, for the
registration of the request. Example -d 0.5
--status [STATUS [STATUS ...]], -s [STATUS [STATUS ...]]
Print the report, based on the request status
--limit LIMIT, -L LIMIT
Limit the output reports. Default 100.
--debug, -D Displays the count of unparsed lines and the unparsed
line numbers
examples:
::
nginxparser -l /path/to/access_nginx.log -t -e /static /exclude
nginxparser -l /path/to/access_nginx.log -s 500 499 -o /path/to/outfile.txt
nginxparser -l ../nginx_access.log -o ../test_all.txt -e /static /pull -tcmrS -s 499 500 -p 2015.10.06_00:00:00 2015.10.07_00:00:00
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nginxparser-0.8.tar.gz
(5.3 kB
view details)
File details
Details for the file nginxparser-0.8.tar.gz
.
File metadata
- Download URL: nginxparser-0.8.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e09534ca5fc5ce956cf0b994aed49d00ab6ba3415a10aea97502c360e2f18635 |
|
MD5 | 94b2bf2e879ad29914b149bfec4db421 |
|
BLAKE2b-256 | 3b58725a6034178281c5182dad5134c896d6529d689da5a620e7c83e7aacf060 |