diff --git a/controlpanel/api/elasticsearch.py b/controlpanel/api/elasticsearch.py index 97f028196..9c58415ae 100644 --- a/controlpanel/api/elasticsearch.py +++ b/controlpanel/api/elasticsearch.py @@ -33,9 +33,14 @@ def app_logs(app, num_hours=None): conn = Elasticsearch(hosts=settings.ELASTICSEARCH['hosts']) s = Search(using=conn, index=settings.ELASTICSEARCH['indices']['app-logs']) - s = s.query( + # limit fields returned + s = s.source(['@timestamp', 'message']) + + s = s.filter( Q('exists', field='message') - & Q('match', app_name=f'{app.release_name}-webapp') + & Q('term', **{ + "app_name.keyword": f'{app.release_name}-webapp', + }) ) s = s.filter(Range(**{ diff --git a/controlpanel/frontend/static/components/app-logs/macro.html b/controlpanel/frontend/static/components/app-logs/macro.html index e0734e036..1977bd4eb 100644 --- a/controlpanel/frontend/static/components/app-logs/macro.html +++ b/controlpanel/frontend/static/components/app-logs/macro.html @@ -1,11 +1,9 @@ {% macro app_logs(app, kibana_base_url) %} - {# disable app logs temporarily
{% for entry in app.get_logs() -%}{% endfor %}