summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Kravcenko <bndrzz@gmail.com>2014-03-21 18:28:39 +0100
committerVadim Kravcenko <bndrzz@gmail.com>2014-03-21 18:28:39 +0100
commitc4b92fc759dcbf1c9459fbf06174d529e731aa3a (patch)
tree554a9ad14f9cf2f614d1f256a246f9edea75331e
parent98e907f879911881e46269197ba45bfd8b3378d0 (diff)
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.
-rwxr-xr-xngxtop.py5
1 files changed, 4 insertions, 1 deletions
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