From 5a73ee7c8b2d677e125db360243378932b59cf73 Mon Sep 17 00:00:00 2001 From: Quentin Durand Date: Thu, 26 Jul 2018 12:15:56 +0200 Subject: [PATCH] limit the number of logs lines for system view --- src/dashboard/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/dashboard/views.py b/src/dashboard/views.py index 1274592..b516244 100644 --- a/src/dashboard/views.py +++ b/src/dashboard/views.py @@ -27,6 +27,7 @@ import utils.celme as celme from collections import OrderedDict SUN_ELEV_DAY_THRESHOLD = -10 +MAX_LOGS_LINES = 100 log = l.setupLogger("dashboard", "dashboard") @@ -229,12 +230,12 @@ def system_retrieve_logs(request): Called by the dashboard system page with ajax request every seconds, to get the logs and print them ''' if request.is_ajax(): - alert_logs = Log.objects.filter(agent='Alert manager').order_by("-created") - scheduler_logs = Log.objects.filter(agent='Scheduler').order_by("-created") - majordome_logs = Log.objects.filter(agent='Majordome').order_by("-created") - obs_logs = Log.objects.filter(agent='Observation manager').order_by("-created") - analyzer_logs = Log.objects.filter(agent='Analyzer').order_by("-created") - monitoring_logs = Log.objects.filter(agent='Monitoring').order_by("-created") + alert_logs = Log.objects.filter(agent='Alert manager').order_by("-created")[:MAX_LOGS_LINES] + scheduler_logs = Log.objects.filter(agent='Scheduler').order_by("-created")[:MAX_LOGS_LINES] + majordome_logs = Log.objects.filter(agent='Majordome').order_by("-created")[:MAX_LOGS_LINES] + obs_logs = Log.objects.filter(agent='Observation manager').order_by("-created")[:MAX_LOGS_LINES] + analyzer_logs = Log.objects.filter(agent='Analyzer').order_by("-created")[:MAX_LOGS_LINES] + monitoring_logs = Log.objects.filter(agent='Monitoring').order_by("-created")[:MAX_LOGS_LINES] return render(request, 'dashboard/system_logs.html', locals()) -- libgit2 0.21.2