You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haproxy-wi/app/logs.py

54 lines
1.4 KiB

#!/usr/bin/env python3
import html
import cgi
import funct
form = cgi.FieldStorage()
serv = form.getvalue('serv')
funct.head("HAproxy Logs")
funct.check_config()
funct.check_login()
funct.get_auto_refresh("HAproxy logs")
print('<table class="overview">'
7 years ago
'<tr class="overviewHead">'
'<td class="padding10 first-collumn">Server</td>'
7 years ago
'<td>Number rows</td>'
'<td class="padding10">Ex for grep</td>'
7 years ago
'<td> </td>'
7 years ago
'</tr>'
'<tr>'
'<td class="padding10 first-collumn">'
7 years ago
'<form action="logs.py" method="get">'
'<select autofocus required name="serv" id="serv">'
'<option disabled selected>Choose server</option>')
7 years ago
funct.choose_only_select(serv)
print('</select>')
if serv is not None:
rows = 'value='+form.getvalue('rows')
else:
rows = 'value=10'
if form.getvalue('grep') is not None:
grep = 'value='+form.getvalue('grep')
else:
grep = ' '
print('</td><td><input type="number" name="rows" id="rows" %s class="form-control" required></td>' % rows)
print('<td class="padding10 first-collumn"><input type="text" name="grep" id="grep" class="form-control" %s >' % grep)
7 years ago
print('</td>'
'<td class="padding10 first-collumn">'
'<a class="ui-button ui-widget ui-corner-all" id="show" title="Show logs" onclick="showLog()">Show</a>'
'</td>'
'</form>'
'</tr></table>'
'<div id="ajax">'
'</div>'
'<script>'
'window.onload = showLog()'
'</script>')
funct.footer()