From 9b433f05b273bfd466549ba0ce866f9e6cd51182 Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Fri, 23 Jul 2021 12:49:59 +0600 Subject: [PATCH] v5.2.2.0 Changelog: https://haproxy-wi.org/changelog.py#5_2_2 --- app/funct.py | 4 ++-- app/templates/logs.html | 12 ++++++------ app/viewlogs.py | 7 +++++-- inc/script.js | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/funct.py b/app/funct.py index 4e7575dc..ff4f563d 100644 --- a/app/funct.py +++ b/app/funct.py @@ -113,7 +113,7 @@ def logging(serv, action, **kwargs): action + " for: " + serv + "\n" else: mess = get_data('date_in_log') + " " + action + " from " + ip + "\n" - log = open(log_path + "/haproxy-wi-"+get_data('logs')+".log", "a") + log = open(log_path + "/roxy-wi-"+get_data('logs')+".log", "a") elif kwargs.get('provisioning') == 1: mess = get_data('date_in_log') + " from " + ip + " user: " + login + ", group: " + user_group + ", " + \ action + "\n" @@ -1000,7 +1000,7 @@ def haproxy_wi_log(**kwargs): group_grep = '|grep "group: ' + user_group + '"' else: group_grep = '' - cmd = "find "+log_path+"/haproxy-wi-* -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | head -1 |awk '{print $4}' |xargs tail"+group_grep+"|sort -r" + cmd = "find "+log_path+"/roxy-wi-* -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | head -1 |awk '{print $4}' |xargs tail"+group_grep+"|sort -r" output, stderr = subprocess_execute(cmd) return output diff --git a/app/templates/logs.html b/app/templates/logs.html index ed90c7f4..992d4924 100644 --- a/app/templates/logs.html +++ b/app/templates/logs.html @@ -16,8 +16,8 @@ WAF logs {% endif %} Number rows - Find (?) - Exclude (?) + Find + Exclude {{ input('time_range_out_hour', value=hour, class='time-range', readonly='readonly') }}:{{ input('time_range_out_minut', value=minut, class='time-range', readonly='readonly') }} @@ -33,8 +33,8 @@ {% for select in selects %} {% if page == 'for_editor' %} - {% if select.1.startswith('haproxy-wi') or select.1.startswith('config_edit') or select.1.startswith('port_sca') %} - {% if select.0|int() == serv|int() %} + {% if select.1.startswith('roxy-wi') or select.1.startswith('config_edit') or select.1.startswith('port_sca') %} + {% if select.0 == serv %} {% else %} @@ -78,7 +78,7 @@
-{% if select_id == 'viewlogs' and serv != '' and viewlogs != '' and viewlogs != 'haproxy-wi.error.log' and viewlogs != 'haproxy-wi.access.log' %} +{% if select_id == 'viewlogs' and serv != '' and viewlogs != '' and viewlogs != 'roxy-wi.error.log' and viewlogs != 'roxy-wi.access.log' %} diff --git a/app/viewlogs.py b/app/viewlogs.py index 73eae88d..639d717b 100644 --- a/app/viewlogs.py +++ b/app/viewlogs.py @@ -14,6 +14,8 @@ if form.getvalue('grep') is None: else: grep = form.getvalue('grep') +exgrep = form.getvalue('exgrep') if form.getvalue('exgrep') else '' + if form.getvalue('rows') is None: rows = 10 else: @@ -65,8 +67,8 @@ except Exception: selects = funct.get_files(log_path, format="log") if form.getvalue('type') is None: selects.append(['fail2ban.log', 'fail2ban.log']) - selects.append(['haproxy-wi.error.log', 'error.log']) - selects.append(['haproxy-wi.access.log', 'access.log']) + selects.append(['roxy-wi.error.log', 'error.log']) + selects.append(['roxy-wi.access.log', 'access.log']) output_from_parsed_template = template.render(h2=1, autorefresh=1, @@ -78,6 +80,7 @@ output_from_parsed_template = template.render(h2=1, selects=selects, rows=rows, grep=grep, + exgrep=exgrep, hour=hour, hour1=hour1, minut=minut, diff --git a/inc/script.js b/inc/script.js index 53b70ac8..8bf729c4 100644 --- a/inc/script.js +++ b/inc/script.js @@ -586,7 +586,7 @@ function findGetParameter(parameterName) { return result; } function viewLogs() { - if($('#viewlogs').val() == 'haproxy-wi.error.log' || $('#viewlogs').val() == 'haproxy-wi.access.log' || $('#viewlogs').val() == 'fail2ban.log') { + if($('#viewlogs').val() == 'roxy-wi.error.log' || $('#viewlogs').val() == 'roxy-wi.access.log' || $('#viewlogs').val() == 'fail2ban.log') { showApacheLog($('#viewlogs').val()); } else { var rows = $('#rows').val()