new options
This commit is contained in:
24
app.py
24
app.py
@@ -100,11 +100,29 @@ def display_haproxy_stats():
|
||||
parsed_stats = parse_haproxy_stats(haproxy_stats)
|
||||
return render_template('statistics.html', stats=parsed_stats)
|
||||
|
||||
|
||||
@app.route('/logs')
|
||||
def display_logs():
|
||||
@requires_auth
|
||||
def display_haproxy_logs():
|
||||
log_file_path = '/var/log/haproxy.log'
|
||||
parsed_entries = parse_log_file(log_file_path)
|
||||
return render_template('logs.html', entries=parsed_entries)
|
||||
|
||||
if not os.path.exists(log_file_path):
|
||||
return render_template('logs.html',
|
||||
logs=[],
|
||||
error_message=f"Log file not found: {log_file_path}")
|
||||
|
||||
try:
|
||||
logs = parse_log_file(log_file_path)
|
||||
if not logs:
|
||||
return render_template('logs.html',
|
||||
logs=[],
|
||||
error_message="Log file is empty or unreadable")
|
||||
return render_template('logs.html', logs=logs)
|
||||
except Exception as e:
|
||||
return render_template('logs.html',
|
||||
logs=[],
|
||||
error_message=f"Error parsing logs: {str(e)}")
|
||||
|
||||
|
||||
@app.route('/home')
|
||||
def home():
|
||||
|
||||
Reference in New Issue
Block a user