lebinh / ngxtop Goto Github PK
View Code? Open in Web Editor NEWReal-time metrics for nginx server
License: MIT License
Real-time metrics for nginx server
License: MIT License
Hello!
[michael_xiii@new-host ~]$ sudo /usr/bin/pip-python install ngxtop
Downloading/unpacking ngxtop
Downloading ngxtop-0.0.2.tar.gz
Running setup.py egg_info for package ngxtop
Downloading/unpacking docopt (from ngxtop)
Downloading docopt-0.6.2.tar.gz
Running setup.py egg_info for package docopt
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/home/michael_xiii/build/docopt/setup.py", line 3, in ?
from docopt import __version__
File "docopt.py", line 49
uniq = list(set(self.flat())) if uniq is None else uniq
^
SyntaxError: invalid syntax
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/home/michael_xiii/build/docopt/setup.py", line 3, in ?
from docopt import __version__
File "docopt.py", line 49
uniq = list(set(self.flat())) if uniq is None else uniq
^
SyntaxError: invalid syntax
----------------------------------------
Command python setup.py egg_info failed with error code 1
Python 2.4.3 (#1, Jan 9 2013, 06:47:03)
Linux XXX 2.6.18-238.19.1.el5.028stab092.2 #1 SMP Thu Jul 21 19:23:22 MSD 2011 x86_64 x86_64 x86_64 GNU/Linux
I checked (with pyenv):
works perfectly with python 2.7.5
when changing to python 2.7.6 broke with this error:
Traceback (most recent call last):
File "/home/alon/.pyenv/versions/2.7.6/bin/ngxtop", line 9, in
load_entry_point('ngxtop==0.0.2', 'console_scripts', 'ngxtop')()
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 348, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2311, in load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2025, in load
File "/home/alon/.pyenv/versions/2.7.6/lib/python2.7/site-packages/ngxtop/ngxtop.py", line 61, in
import curses
File "/home/alon/.pyenv/versions/2.7.6/lib/python2.7/curses/init.py", line 15, in
from _curses import *
ImportError: No module named _curses
BESIDES: great tool! love to use it
this is my command line: /usr/local/bin/ngxtop -l /opt/logs/access.log -f '[$local]' top remote_addr -t 1
but,there is not any data as follow. why? thanks.
running for 136 seconds, 0 records processed: 0.00 req/sec
top remote_addr
| remote_addr | count |
|---------------+---------|
I run this :
ngxtop --no-follow -i 'upstream_response_time >=2' print upstream_response_time request
and all rows are returned. the -i filter has no effect.
nginx configuration file: /etc/nginx/nginx.conf access log file: /var/log/nginx-access.log access log format: $remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_time $upstream_response_time $pipe available variables: body_bytes_sent, http_referer, http_user_agent, pipe, remote_addr, request, request_time, status, time_local, upstream_response_time
It currently has: Copyright (c) [year] [fullname]
ngxtop is a nice tool, but I don't see a way to use it for old logs - while it does show the output nicely during log parsing, the output is garbled when log parsing finishes - see below for an example.
It would be nice if ngxtop had some kind of CSV/table/text output for such cases.
running for 0 seconds, 1000 records processed: 20227.36 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 1000 | 223.154 | 999 | 0 | 1 | 0 |
Detailed:
| request_path | count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|-------------------------+---------+------------------+-------+-------+-------+-------|
| /v2/api/execute.php | 985 | 223.951 | 985 | 0 | 0 | 0 |
| /v2/api/healthcheck.php | 15 | 170.800 | 14 | 0 | 1 | 0 |
I run ngxtop in virtualenv: can not find config_parser
(py3virtualenv)[root@xxxx ~]# ngxtop
Traceback (most recent call last):
File "/root/py3virtualenv/bin/ngxtop", line 7, in
from ngxtop.ngxtop import main
File "/root/py3virtualenv/lib/python3.4/site-packages/ngxtop/ngxtop.py", line 77, in
from config_parser import detect_log_config, detect_config_path, extract_variables, build_pattern
ImportError: No module named 'config_parser'
centos
python 3.4.1
when run ngxtop,it will have "ImportError: No module named _curses",how can i solve the problem?
Invocation like:
$ ngnxtop -l path_to/my_access.log
The acces.log has a normal format, like in nginx.conf: "access_log path_to/my_access.log;"
running for 10 seconds, 0 records processed: 0.00 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 0 | | 0 | 0 | 0 | 0 |
Detailed:
Traceback (most recent call last):
File "/usr/local/bin/ngxtop", line 9, in
load_entry_point('ngxtop==0.0.1', 'console_scripts', 'ngxtop')()
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 446, in main
process(args)
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 429, in process
total = process_log(source, pattern, processor, arguments)
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 334, in process_log
total = processor.process(records)
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 281, in process
for r in records:
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 215, in add_field
for item in dict_sequence:
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 205, in map_field
for item in dict_sequence:
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 205, in map_field
for item in dict_sequence:
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 215, in add_field
for item in dict_sequence:
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 215, in add_field
for item in dict_sequence:
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 206, in map_field
item[field] = func(item.get(field, None))
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 245, in to_int
return int(value) if value and value != '-' else 0
ValueError: invalid literal for int() with base 10: '"Mozilla/5.0 (X11; Ubuntu;'
I got this error
Error: Access log file or format was not set and nginx config file cannot be detected. Perhaps nginx is not in your PATH?
my python and pip version is
pip -V
pip 1.5.6 from /usr/lib/python2.6/site-packages (python 2.6)
Hi!
I have log like this:
192.168.7.40 - - [31/Mar/2014:04:02:02 +0400] "POST /my/url HTTP/1.0" 200 16 "-" "Zend_Http_Client"
It successfully parsed by ngxtop, but if I have this format:
192.168.7.40 192.168.7.41 - [31/Mar/2014:04:02:02 +0400] "POST /my/url HTTP/1.0" 200 16 "-" "Zend_Http_Client"
It does not parse.
How can I parsed this log? I tried to use --log-format but it did not help me.
http://www.ttlsa.com/nginx/nginx-modules-ngxtop-ttlsa/ section 4.2
Can you solve this problem ? auto-detect inlcude-virtualhost config file and analyze it,This can solve a lots of people's trouble, thank you very much.
Hi !
I'm discovering ngxtop and i feel great about it !
My vhost error log files are split but if i want the overall stats, the catchall caracter doesn't work :
ngxtop -l /var/log/nginx/*/access_log
thx a lot !
I run a CentOS 6.3 box with nginx installed into /opt/nginx
and there doesn't seem to be a way to specify where my conf file is, like there is to specify where my log file is.
Traceback (most recent call last):
File "/usr/bin/ngxtop", line 9, in <module>
load_entry_point('ngxtop==0.0.1', 'console_scripts', 'ngxtop')()
File "/usr/lib/python2.6/site-packages/ngxtop/ngxtop.py", line 446, in main
process(args)
File "/usr/lib/python2.6/site-packages/ngxtop/ngxtop.py", line 409, in process
access_log, log_format = extract_nginx_conf(config, access_log)
File "/usr/lib/python2.6/site-packages/ngxtop/ngxtop.py", line 142, in extract_nginx_conf
with open(path) as conf_file:
IOError: [Errno 2] No such file or directory: '/etc/nginx/nginx.conf'
a REST api has requests like :
/x/y/2da625ba-1199-4e9f-96d9-c80394981952
/x/y/5d46145c-4399-3f4a-fdaa-a40f94934534
ngxtop will consider them as two distinct request.
If I could invoke ngxtop wit a regex that "detects" IDs in the REST paths,
ex: idformat=........-....-................
then the above two calls would become the same, /x/y/xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
then metrics could be produced per call "type".
If you could package this in a way that we can easily start and run as a service, it would be awesome!
ssh remote tail -f /var/log/apache2/access.log | ngxtop -f common
Traceback (most recent call last):
File "/usr/bin/ngxtop", line 9, in
load_entry_point('ngxtop==0.0.2', 'console_scripts', 'ngxtop')()
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 385, in main
process(args)
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 370, in process
process_log(source, pattern, processor, arguments)
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 267, in process_log
processor.process(records)
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 215, in process
for r in records:
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 148, in add_field
for item in dict_sequence:
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 135, in map_field
for item in dict_sequence:
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 135, in map_field
for item in dict_sequence:
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 148, in add_field
for item in dict_sequence:
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 148, in add_field
for item in dict_sequence:
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 135, in map_field
for item in dict_sequence:
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 187, in
records = (m.groupdict() for m in matches if m is not None)
File "/usr/lib/python2.6/site-packages/ngxtop-0.0.2-py2.6.egg/ngxtop/ngxtop.py", line 186, in
matches = (pattern.match(l) for l in lines)
IOError: [Errno 4] Interrupted system call
I'd like to show requests by hostname and request path, so I tried:
ngxtop -g http_host,request_path
which gives me
running for 8 seconds, 0 records processed: 0.00 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 0 | | 0 | 0 | 0 | 0 |
Detailed:
Traceback (most recent call last):
File "/usr/bin/ngxtop", line 9, in <module>
load_entry_point('ngxtop==0.0.1', 'console_scripts', 'ngxtop')()
File "/usr/lib/python2.6/site-packages/ngxtop/ngxtop.py", line 446, in main
process(args)
File "/usr/lib/python2.6/site-packages/ngxtop/ngxtop.py", line 429, in process
total = process_log(source, pattern, processor, arguments)
File "/usr/lib/python2.6/site-packages/ngxtop/ngxtop.py", line 334, in process_log
total = processor.process(records)
File "/usr/lib/python2.6/site-packages/ngxtop/ngxtop.py", line 282, in process
cursor.execute(insert, r)
sqlite3.OperationalError: no such column: request_path
So then I tried nginxtop -g http_host -g request_path
, which just gives me back the usage information. Grouping by either http_host or request_path works fine, it's just the combination together that I can't seem to get working.
Installed on ARM (Arch) and got this error. Could it be Python 3 related?
$ ngxtop
Traceback (most recent call last):
File "/usr/bin/ngxtop", line 7, in <module>
from ngxtop.ngxtop import main
File "/usr/lib/python3.4/site-packages/ngxtop/ngxtop.py", line 77, in <module>
from config_parser import detect_log_config, detect_config_path, extract_variables, build_pattern
ImportError: No module named 'config_parser'
$ python -V
Python 3.4.0
$ python2 -V
Python 2.7.6
I run the that command via ssh
yum -y install python-pip; pip install ngxtop sqlite-devel
And it says:
Installed:
python-pip.noarch 0:7.1.0-1.el7
Complete!
/usr/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting ngxtop
/usr/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading ngxtop-0.0.2-py2.py3-none-any.whl
Collecting sqlite-devel
Could not find a version that satisfies the requirement sqlite-devel (from versions: )
No matching distribution found for sqlite-devel
I think, a sqlite-devel problem.
P.S: Operation system is centos 7 64bit
nginx-wallarm -v
nginx version: nginx/1.8.1
nginx
command not found
ngxtop
Error: Access log file or format was not set and nginx config file cannot be detected. Perhaps nginx is not in your PATH?
After:
ssh [email protected] tail /opt/log/access.log | ngxtop
The ssh prompt the password...
After that nothing happens.
Is there a way to specify a time period and then write that to a file, instead of an interactive session?
It would be nice if ngxtop instructed the end user how to install it.
use ngxtop -c conf/nginx.conf -l logs/access.log
to specify the log_format. When nginx.conf with commented out log_format as following, I cann't not get the expected result.
# log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $request_length $request_time $body_bytes_sent '
'"$http_referer" "$http_user_agent" $server_addr $upstream_addr $host $upstream_cache_status';
After I delete the commented lines, It works as expected.
Their were two quirks I noticed, when trying this on Debian Wheezy as a non-root user with read access to the system logfiles.
nginx is located in /usr/sbin/, which usually is not in $PATH, so it won't find the binary.
The log location could somehow not be determined, I haven't dug through the code much. Had it fall back to '/var/log/nginx/access.log' instead of 'log/access.log'. It detected the nginx.conf, however it wasn't able to extract the access_log path.
% grep "access" /etc/nginx/nginx.conf
access_log /var/log/nginx/access.log;
Centos 6.5
Python 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
./ngxtop.py
Traceback (most recent call last):
File "./ngxtop.py", line 440, in <module>
main(args)
File "./ngxtop.py", line 402, in main
config = get_nginx_conf_path()
File "./ngxtop.py", line 117, in get_nginx_conf_path
proc = subprocess.Popen(['nginx', '-V'], stderr=subprocess.PIPE)
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Does ngxtop save records for its own use , somewhere?
I mean how can it take out the top 20 requests ?
by
ngxtop -n 20
I'm using python 2.7.6
ngxtop --config /usr/local/nginx/conf/nginx.conf
It works for 933 seconds, then I got this
Traceback (most recent call last):
File "/opt/python2.7.6/bin/ngxtop", line 11, in <module>
sys.exit(main())
File "/opt/python2.7.6/lib/python2.7/site-packages/ngxtop/ngxtop.py", line 446, in main
process(args)
File "/opt/python2.7.6/lib/python2.7/site-packages/ngxtop/ngxtop.py", line 429, in process
total = process_log(source, pattern, processor, arguments)
File "/opt/python2.7.6/lib/python2.7/site-packages/ngxtop/ngxtop.py", line 334, in process_log
total = processor.process(records)
File "/opt/python2.7.6/lib/python2.7/site-packages/ngxtop/ngxtop.py", line 282, in process
cursor.execute(insert, r)
sqlite3.ProgrammingError: library routine called out of sequence
Not able to install. appreciate help.
pip.log.zip
Downloading/unpacking ngxtop
Downloading ngxtop-0.0.2-py2.py3-none-any.whl
Downloading/unpacking pyparsing (from ngxtop)
Downloading pyparsing-2.1.1-py2.py3-none-any.whl
Downloading/unpacking docopt (from ngxtop)
Downloading docopt-0.6.2.tar.gz
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
do_download,
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
self.session,
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 582, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 643, in unpack_file
untar_file(filename, location)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 551, in untar_file
os.makedirs(location)
File "/usr/lib/python2.7/os.py", line 157, in makers
mkdir(name, mode)
OSError: [Errno 17] File exists: '/tmp/pip_build_root/docopt'
Storing debug log for failure in /root/.pip/pip.log
Please?
Trying to run ngxtop gives me this:
(2:1977)# ngxtop
Traceback (most recent call last):
File "/usr/local/bin/ngxtop", line 9, in
load_entry_point('ngxtop==0.0.2', 'console_scripts', 'ngxtop')()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 343, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2309, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2015, in load
entry = import(self.module_name, globals(),globals(), ['name'])
ImportError: No module named ngxtop
I figured out how to run it though but would need a permanent solution to this:
(2:1978)# python2 /usr/local/bin/ngxtop.py
Any ideas?
Good day, can we run ngxtop on FreeBSD systems ?
Best regards.
Hello,
My nginx log is defined, like :
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_length $request_time $bytes_sent '
'"$upstream_cache_status"';
What should I use ngxtop with this log_format, I don't discover an option for this situation.
Thanks & Regards
Hello, i have separated log file to any vhost, could you make support for this?
It would be great to monitor which file are taking up the most space. If possible, which ones are requested most.
Hello
Is possible that any way to filter the request_path? For example I want to see analyze the just ".css" files (hit count /4xx 3xx 2xx errors)
Are there any parameter ?
Hi !
I enconter an issue with a custum access log format :
$ ngxtop -c /etc/nginx/site-available/unicorn.conf
Error: Incorrect format name set in config for access log file "blablabla/access_log"
My Nginx vhost :
access_log blablabla/access_log vhosts
And my log format is :
log_format vhosts '$host $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
Thanks a lot !
ngxtop -l /var/log/nginx/access.log
Traceback (most recent call last):
File "/home/adys/bin/ngxtop", line 437, in <module>
main(args)
File "/home/adys/bin/ngxtop", line 420, in main
total = process_log(source, pattern, processor, arguments)
File "/home/adys/bin/ngxtop", line 325, in process_log
total = processor.process(records)
File "/home/adys/bin/ngxtop", line 272, in process
for r in records:
File "/home/adys/bin/ngxtop", line 206, in add_field
for item in dict_sequence:
File "/home/adys/bin/ngxtop", line 196, in map_field
for item in dict_sequence:
File "/home/adys/bin/ngxtop", line 196, in map_field
for item in dict_sequence:
File "/home/adys/bin/ngxtop", line 206, in add_field
for item in dict_sequence:
File "/home/adys/bin/ngxtop", line 206, in add_field
for item in dict_sequence:
File "/home/adys/bin/ngxtop", line 196, in map_field
for item in dict_sequence:
File "/home/adys/bin/ngxtop", line 245, in <genexpr>
records = (m.groupdict() for m in matches if m is not None)
File "/home/adys/bin/ngxtop", line 244, in <genexpr>
matches = (pattern.match(l) for l in lines)
File "/home/adys/bin/ngxtop", line 181, in follow
with open(the_file) as f:
IOError: [Errno 2] No such file or directory: 'logs/access.log'
Can you help me what problem is?
no data summary from access log
running for 42 seconds, 0 records processed: 0.00 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 0 || 0 | 0 | 0 | 0 |
Detailed:
| request_path | count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|----------------+---------+------------------+-------+-------+-------+-------|246
After running for a while, it raised RuntimeError: maximum recursion depth exceeded while calling a Python object.
File "/usr/local/lib/python2.7/site-packages/ngxtop/ngxtop.py", line 233, in report
result = tabulate.tabulate(cursor.fetchall(), headers=columns, tablefmt='orgtbl', floatfmt='.3f')
File "/usr/local/lib/python2.7/site-packages/tabulate.py", line 753, in tabulate
coltypes = list(map(_column_type, cols)) File "/usr/local/lib/python2.7/site-packages/tabulate.py", line 426, in _column_type
types = [_type(s, has_invisible) for s in strings ]
File "/usr/local/lib/python2.7/site-packages/tabulate.py", line 260, in _type (isinstance(string, _text_type) or isinstance(string, _binary_type)):
RuntimeError: maximum recursion depth exceeded while calling a Python object
I'm trying to use ngxtop on logs from https://github.com/nginx-boilerplate/nginx-boilerplate
But with no luck. No errors. Just 0 records processed: 0.00 req/sec
I used default boilerplate configs, tried to move log format into my sites config file, used every option from ngxtop...
Tried several times, on site access logs, on default access logs... Nothing.
Looks like something wrong with me... Or ngxtop doesnt work with that nginx boilerplate...
Can someone test it ?
Hello,
After
$ pip install docopt tabulate
I have:
$ python -V
Python 2.7.4
$ grep access_log /etc/nginx/nginx.conf
access_log /var/log/nginx/access.log;
but log file is not detected:
$ python ngxtop.py info
configuration file:
/etc/nginx/nginx.conf
access log file:
logs/access.log
access log format:
combined
available variables:
What's more, explicitly setting the log file breaks:
$ python ngxtop.py --access-log /var/log/nginx/access.log
Traceback (most recent call last):
File "ngxtop.py", line 437, in
main(args)
File "ngxtop.py", line 420, in main
total = process_log(source, pattern, processor, arguments)
File "ngxtop.py", line 325, in process_log
total = processor.process(records)
File "ngxtop.py", line 272, in process
for r in records:
File "ngxtop.py", line 206, in add_field
for item in dict_sequence:
File "ngxtop.py", line 196, in map_field
for item in dict_sequence:
File "ngxtop.py", line 196, in map_field
for item in dict_sequence:
File "ngxtop.py", line 206, in add_field
for item in dict_sequence:
File "ngxtop.py", line 206, in add_field
for item in dict_sequence:
File "ngxtop.py", line 196, in map_field
for item in dict_sequence:
File "ngxtop.py", line 245, in
records = (m.groupdict() for m in matches if m is not None)
File "ngxtop.py", line 244, in
matches = (pattern.match(l) for l in lines)
File "ngxtop.py", line 181, in follow
with open(the_file) as f:
IOError: [Errno 2] No such file or directory: 'logs/access.log'
thanks!
ngxtop latest version installed via pip on CentOS 6.6 64bit
ngxtop --version
xstat 0.1
command used
ngxtop -l /home/nginx/domains/domain.com/log/access.log.norotate --group-by remote_addr --no-follow
results in output of
running for 0 seconds, 0 records processed: 0.00 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 0 | | 0 | 0 | 0 | 0 |
Detailed:
| remote_addr | count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------------+---------+------------------+-------+-------+-------+-------|
log file contents only 5 lines of
IPADDRESS - - [14/Jun/2015:00:52:57 +0000] GET /url HTTP/1.1 "200" 31 "-" "curl/7.29.0" "-" "-" "8" "1" "0.000"
Hi!
Please choose a license if you're intending for this to be used more broadly.
sarah
Hi I am playing around with ngxtop for my Centmin Mod Nginx project https://gist.github.com/centminmod/d613128cdb9eed86c9ec and was wondering do ngxtop live stats work with buffered access_log files ?
I can not see any live stats but when i use --no-follow
i do see previously logged data
thanks
Can't seem to find that package.
Traceback (most recent call last):
File "/usr/local/bin/ngxtop", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 385, in main
process(args)
File "/usr/local/lib/python2.7/dist-packages/ngxtop/ngxtop.py", line 367, in process
pattern = build_pattern(log_format)
File "/usr/local/lib/python2.7/dist-packages/ngxtop/config_parser.py", line 137, in build_pattern
return re.compile(pattern)
File "/usr/lib/python2.7/re.py", line 190, in compile
return _compile(pattern, flags)
File "/usr/lib/python2.7/re.py", line 242, in _compile
raise error, v # invalid expression
sre_constants.error: redefinition of group name 'remote_addr' as group 17; was group 3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.