Commit 5a73ee7c8b2d677e125db360243378932b59cf73

Authored by Quentin Durand
1 parent fc957772
Exists in dev

limit the number of logs lines for system view

Showing 1 changed file with 7 additions and 6 deletions   Show diff stats
src/dashboard/views.py
... ... @@ -27,6 +27,7 @@ import utils.celme as celme
27 27 from collections import OrderedDict
28 28  
29 29 SUN_ELEV_DAY_THRESHOLD = -10
  30 +MAX_LOGS_LINES = 100
30 31  
31 32 log = l.setupLogger("dashboard", "dashboard")
32 33  
... ... @@ -229,12 +230,12 @@ def system_retrieve_logs(request):
229 230 Called by the dashboard system page with ajax request every seconds, to get the logs and print them
230 231 '''
231 232 if request.is_ajax():
232   - alert_logs = Log.objects.filter(agent='Alert manager').order_by("-created")
233   - scheduler_logs = Log.objects.filter(agent='Scheduler').order_by("-created")
234   - majordome_logs = Log.objects.filter(agent='Majordome').order_by("-created")
235   - obs_logs = Log.objects.filter(agent='Observation manager').order_by("-created")
236   - analyzer_logs = Log.objects.filter(agent='Analyzer').order_by("-created")
237   - monitoring_logs = Log.objects.filter(agent='Monitoring').order_by("-created")
  233 + alert_logs = Log.objects.filter(agent='Alert manager').order_by("-created")[:MAX_LOGS_LINES]
  234 + scheduler_logs = Log.objects.filter(agent='Scheduler').order_by("-created")[:MAX_LOGS_LINES]
  235 + majordome_logs = Log.objects.filter(agent='Majordome').order_by("-created")[:MAX_LOGS_LINES]
  236 + obs_logs = Log.objects.filter(agent='Observation manager').order_by("-created")[:MAX_LOGS_LINES]
  237 + analyzer_logs = Log.objects.filter(agent='Analyzer').order_by("-created")[:MAX_LOGS_LINES]
  238 + monitoring_logs = Log.objects.filter(agent='Monitoring').order_by("-created")[:MAX_LOGS_LINES]
238 239 return render(request, 'dashboard/system_logs.html', locals())
239 240  
240 241  
... ...