From c4b92fc759dcbf1c9459fbf06174d529e731aa3a Mon Sep 17 00:00:00 2001 From: Vadim Kravcenko Date: Fri, 21 Mar 2014 18:28:39 +0100 Subject: Update ngxtop.py Use the log file from config only when not supplied with --access-log option, else it is overwritten everytime, even when --access-log option is provided. --- ngxtop.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ngxtop.py b/ngxtop.py index f8da2e0..69a4285 100755 --- a/ngxtop.py +++ b/ngxtop.py @@ -150,7 +150,10 @@ def extract_nginx_conf(path, log_file=None, log_format=None): log_format = log_format.replace("'", "") access_log_directive = re.search(r'access_log\s+(\S+)\s+%s' % log_format_name, conf) - log_file = access_log_directive.group(1) if access_log_directive else 'logs/access.log' + # Use the log file from config only when not supplied with --access-log option, + # else it is overwritten everytime. + if not log_file: + log_file = access_log_directive.group(1) if access_log_directive else 'logs/access.log' return log_file, log_format -- cgit v1.2.3