diff --git a/app/funct.py b/app/funct.py index 2393935b..3a7adb32 100644 --- a/app/funct.py +++ b/app/funct.py @@ -705,12 +705,22 @@ def show_haproxy_log(serv, rows=10, waf='0', grep=None, hour='00', minut='00', h return ssh_command(syslog_server, commands, show_log='1') -def haproxy_wi_log(): +def haproxy_wi_log(**kwargs): log_path = get_config_var('main', 'log_path') - 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|sort -r" - output, stderr = subprocess_execute(cmd) - - return output + + if kwargs.get('log_id'): + selects = get_files(log_path, format="log") + for key, value in selects: + if kwargs.get('with_date'): + log_file = kwargs.get('file')+get_data('logs')+".log" + else: + log_file = kwargs.get('file')+".log" + if log_file == value: + return key + else: + 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|sort -r" + output, stderr = subprocess_execute(cmd) + return output def show_ip(stdout): diff --git a/app/overview.py b/app/overview.py index 1e8d3db0..c31b08e8 100644 --- a/app/overview.py +++ b/app/overview.py @@ -61,7 +61,12 @@ template = template.render(h2 = 1, checker_worker = ''.join(checker_worker), keep_alive = ''.join(keep_alive), api = ''.join(api), - date = funct.get_data('logs'), + haproxy_wi_log_id = funct.haproxy_wi_log(log_id=1, file="haproxy-wi-", with_date=1), + metrics_log_id = funct.haproxy_wi_log(log_id=1, file="metrics-", with_date=1), + checker_log_id = funct.haproxy_wi_log(log_id=1, file="checker-", with_date=1), + keep_alive_log_id = funct.haproxy_wi_log(log_id=1, file="keep_alive"), + checker_error_log_id = funct.haproxy_wi_log(log_id=1, file="checker-error"), + metrics_error_log_id = funct.haproxy_wi_log(log_id=1, file="metrics-error"), error = stderr, versions = funct.versions(), haproxy_wi_log = funct.haproxy_wi_log(), diff --git a/app/templates/logs.html b/app/templates/logs.html index 17ff2f0d..c1633e13 100644 --- a/app/templates/logs.html +++ b/app/templates/logs.html @@ -31,7 +31,7 @@