mirror of https://github.com/Aidaho12/haproxy-wi
parent
e712586d1b
commit
9b433f05b2
|
@ -113,7 +113,7 @@ def logging(serv, action, **kwargs):
|
||||||
action + " for: " + serv + "\n"
|
action + " for: " + serv + "\n"
|
||||||
else:
|
else:
|
||||||
mess = get_data('date_in_log') + " " + action + " from " + ip + "\n"
|
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:
|
elif kwargs.get('provisioning') == 1:
|
||||||
mess = get_data('date_in_log') + " from " + ip + " user: " + login + ", group: " + user_group + ", " + \
|
mess = get_data('date_in_log') + " from " + ip + " user: " + login + ", group: " + user_group + ", " + \
|
||||||
action + "\n"
|
action + "\n"
|
||||||
|
@ -1000,7 +1000,7 @@ def haproxy_wi_log(**kwargs):
|
||||||
group_grep = '|grep "group: ' + user_group + '"'
|
group_grep = '|grep "group: ' + user_group + '"'
|
||||||
else:
|
else:
|
||||||
group_grep = ''
|
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)
|
output, stderr = subprocess_execute(cmd)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
<td style="width: 5%;">WAF logs</td>
|
<td style="width: 5%;">WAF logs</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>Number rows</td>
|
<td>Number rows</td>
|
||||||
<td class="padding10"><span title="Find in log file(supports regular expressions)">Find (?)<span></td>
|
<td class="padding10 help_cursor"><span title="Find in log file(supports regular expressions)">Find<span></td>
|
||||||
<td class="padding10"><span title="Exclude from search in log file(supports regular expressions)">Exclude (?)<span></td>
|
<td class="padding10 help_cursor"><span title="Exclude from search in log file(supports regular expressions)">Exclude<span></td>
|
||||||
<td style="width: 10%;">
|
<td style="width: 10%;">
|
||||||
<label for="time_range_out_hour" style="padding: 0">Time range:</label>
|
<label for="time_range_out_hour" style="padding: 0">Time range:</label>
|
||||||
{{ input('time_range_out_hour', value=hour, class='time-range', readonly='readonly') }}:{{ input('time_range_out_minut', value=minut, class='time-range', readonly='readonly') }}
|
{{ 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 @@
|
||||||
<option disabled selected>Choose log</option>
|
<option disabled selected>Choose log</option>
|
||||||
{% for select in selects %}
|
{% for select in selects %}
|
||||||
{% if page == 'for_editor' %}
|
{% if page == 'for_editor' %}
|
||||||
{% if select.1.startswith('haproxy-wi') or select.1.startswith('config_edit') or select.1.startswith('port_sca') %}
|
{% if select.1.startswith('roxy-wi') or select.1.startswith('config_edit') or select.1.startswith('port_sca') %}
|
||||||
{% if select.0|int() == serv|int() %}
|
{% if select.0 == serv %}
|
||||||
<option value="{{ select.0 }}" selected>{{ select.1 }}</option>
|
<option value="{{ select.0 }}" selected>{{ select.1 }}</option>
|
||||||
{% else %}
|
{% else %}
|
||||||
<option value="{{ select.0 }}">{{ select.1 }}</option>
|
<option value="{{ select.0 }}">{{ select.1 }}</option>
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
</table>
|
</table>
|
||||||
<div id="ajax">
|
<div id="ajax">
|
||||||
</div>
|
</div>
|
||||||
{% 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' %}
|
||||||
<script>
|
<script>
|
||||||
viewLogs()
|
viewLogs()
|
||||||
if (window.matchMedia('(max-width: 786px)').matches || window.matchMedia('(max-width: 1024px)').matches || window.matchMedia('(max-width: 667px)').matches) {
|
if (window.matchMedia('(max-width: 786px)').matches || window.matchMedia('(max-width: 1024px)').matches || window.matchMedia('(max-width: 667px)').matches) {
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
<div class="add-note addName alert-info" style="width: inherit; margin-right: 15px;">
|
||||||
You can read the descriptions about all logs <a href="https://roxy-wi.org/description.py?description=logs" title="Servers description" target="_blank">here</a>
|
You can read the descriptions about all logs <a href="https://roxy-wi.org/description.py?description=logs" title="Servers description" target="_blank">here</a>
|
||||||
</div>
|
</div>
|
||||||
{% elif serv == 'haproxy-wi.error.log' or serv == 'haproxy-wi.access.log' %}
|
{% elif serv == 'roxy-wi.error.log' or serv == 'roxy-wi.access.log' %}
|
||||||
<script>
|
<script>
|
||||||
showApacheLog('{{serv}}');
|
showApacheLog('{{serv}}');
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,6 +14,8 @@ if form.getvalue('grep') is None:
|
||||||
else:
|
else:
|
||||||
grep = form.getvalue('grep')
|
grep = form.getvalue('grep')
|
||||||
|
|
||||||
|
exgrep = form.getvalue('exgrep') if form.getvalue('exgrep') else ''
|
||||||
|
|
||||||
if form.getvalue('rows') is None:
|
if form.getvalue('rows') is None:
|
||||||
rows = 10
|
rows = 10
|
||||||
else:
|
else:
|
||||||
|
@ -65,8 +67,8 @@ except Exception:
|
||||||
selects = funct.get_files(log_path, format="log")
|
selects = funct.get_files(log_path, format="log")
|
||||||
if form.getvalue('type') is None:
|
if form.getvalue('type') is None:
|
||||||
selects.append(['fail2ban.log', 'fail2ban.log'])
|
selects.append(['fail2ban.log', 'fail2ban.log'])
|
||||||
selects.append(['haproxy-wi.error.log', 'error.log'])
|
selects.append(['roxy-wi.error.log', 'error.log'])
|
||||||
selects.append(['haproxy-wi.access.log', 'access.log'])
|
selects.append(['roxy-wi.access.log', 'access.log'])
|
||||||
|
|
||||||
output_from_parsed_template = template.render(h2=1,
|
output_from_parsed_template = template.render(h2=1,
|
||||||
autorefresh=1,
|
autorefresh=1,
|
||||||
|
@ -78,6 +80,7 @@ output_from_parsed_template = template.render(h2=1,
|
||||||
selects=selects,
|
selects=selects,
|
||||||
rows=rows,
|
rows=rows,
|
||||||
grep=grep,
|
grep=grep,
|
||||||
|
exgrep=exgrep,
|
||||||
hour=hour,
|
hour=hour,
|
||||||
hour1=hour1,
|
hour1=hour1,
|
||||||
minut=minut,
|
minut=minut,
|
||||||
|
|
|
@ -586,7 +586,7 @@ function findGetParameter(parameterName) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
function viewLogs() {
|
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());
|
showApacheLog($('#viewlogs').val());
|
||||||
} else {
|
} else {
|
||||||
var rows = $('#rows').val()
|
var rows = $('#rows').val()
|
||||||
|
|
Loading…
Reference in New Issue